This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void fetch(String association, Object entity) { | |
if(association == null || entity == null){ | |
return; | |
} | |
String hql = Utils.appendAll("SELECT n.", association, " FROM ", entity.getClass().getSimpleName(), " n WHERE n.id = :id").toString(); | |
Query query = em.createQuery(hql); | |
try { | |
Object id = PropertyUtils.getProperty(entity, "id"); | |
query.setParameter("id", id); | |
List<?> result = query.getResultList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<context:property-placeholder location="classpath:application-model.properties" /> | |
<jpa:repositories base-package="com.model.dao" /> | |
<context:annotation-config /> | |
<context:component-scan base-package="com.model" /> | |
<bean id="dataSource" | |
class="org.springframework.jdbc.datasource.DriverManagerDataSource" | |
p:driverClassName="${database.driver}" p:url="${database.url}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Either the user's pre-configured {@link ConversionService} or the | |
* {@link DefaultConversionService}. | |
* | |
* @return | |
*/ | |
@Bean | |
ConversionService conversionService() { | |
if (null != customConversionService) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autowired(required = false) | |
RestConversionService customConversionService = new RestConversionService(); | |
/** | |
* Either the user's pre-configured {@link ConversionService} or the | |
* {@link DefaultConversionService}. | |
* | |
* @return | |
*/ | |
@Bean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="jsonConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> | |
<property name="supportedMediaTypes" value="application/json" /> | |
</bean> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate"> | |
<property name="messageConverters"> | |
<list> | |
<ref bean="jsonConverter" /> | |
<ref bean="stringConverter" /> | |
</list> | |
</property> | |
</bean> | |
<bean id="jsonConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ evoila-rest --- | |
[INFO] de.rest:rest:war:1.0-SNAPSHOT | |
[INFO] +- org.springframework.data:spring-data-rest-webmvc:jar:1.0.0.BUILD-SNAPSHOT:compile | |
[INFO] | +- org.springframework.data:spring-data-rest-repository:jar:1.0.0.BUILD-SNAPSHOT:compile | |
[INFO] | | \- org.springframework.data:spring-data-rest-core:jar:1.0.0.BUILD-SNAPSHOT:compile | |
[INFO] | | \- com.google.guava:guava:jar:12.0:compile | |
[INFO] | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile | |
[INFO] | +- ch.qos.logback:logback-classic:jar:1.0.6:runtime | |
[INFO] | | \- ch.qos.logback:logback-core:jar:1.0.6:runtime | |
[INFO] | +- javax.validation:validation-api:jar:1.0.0.GA:compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hibernate: select sla0_."Id" as Id1_23_0_, sla0_."Description" as Descript2_23_0_, sla0_."Name" as Name3_23_0_, sla0_."Enabled" as Enabled4_23_0_, sla0_."Price" as Price5_23_0_, sla0_."Provider_id" as Provider6_23_0_, sla0_."SLALevel_id" as SLALevel7_23_0_ from "Sla" sla0_ where sla0_."Id"=? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Handler<Object, ResponseEntity<?>> entityHandler = new Handler<Object, ResponseEntity<?>>() { | |
@Override public ResponseEntity<?> handle(Object linkedEntity) { | |
if(attrMeta.isCollectionLike()) { | |
Collection c = new ArrayList(); | |
Collection current = attrMeta.asCollection(entity); | |
if(request.getMethod() == HttpMethod.POST && null != current) { | |
c.addAll(current); | |
} | |
c.add(linkedEntity); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
links: [ | |
{ | |
rel: "sla.search", | |
href: "http://localhost:8080/rest/sla/search" | |
} | |
], | |
content: [ | |
{ | |
links: [ |
OlderNewer