Modified:
/lambico-spring-hibernate/src/main/java/org/lambico/spring/dao/hibernate/HibernateGenericBusinessDao.java
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/HibernateGenericBusinessDaoTest.java
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/bo/EntityTCBusinessDao.java
/lambico-spring-hibernate/src/test/resources/applicationContext_test.xml
=======================================
---
/lambico-spring-hibernate/src/main/java/org/lambico/spring/dao/hibernate/HibernateGenericBusinessDao.java
Mon Jan 3 08:54:22 2011
+++
/lambico-spring-hibernate/src/main/java/org/lambico/spring/dao/hibernate/HibernateGenericBusinessDao.java
Sun Mar 6 01:19:55 2011
@@ -20,6 +20,7 @@
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
import java.util.List;
import javax.annotation.Resource;
import org.hibernate.Criteria;
@@ -65,8 +66,11 @@
* Build the DAO.
*/
public HibernateGenericBusinessDao() {
- this.persistentClass = (Class<T>) ((ParameterizedType) getClass().
- getGenericSuperclass()).getActualTypeArguments()[0];
+ Type genericSuperclass = getClass().getGenericSuperclass();
+ if (!(genericSuperclass instanceof ParameterizedType)) {
+ genericSuperclass =
((Class)genericSuperclass).getGenericSuperclass();
+ }
+ this.persistentClass = (Class<T>) ((ParameterizedType)
genericSuperclass).getActualTypeArguments()[0];
}
/**
=======================================
---
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/HibernateGenericBusinessDaoTest.java
Sat Feb 6 03:14:05 2010
+++
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/HibernateGenericBusinessDaoTest.java
Sun Mar 6 01:19:55 2011
@@ -18,10 +18,10 @@
package org.lambico.spring.dao.hibernate;
-import org.lambico.spring.dao.hibernate.bo.EntityTCBusinessDao;
import org.lambico.spring.dao.hibernate.po.EntityTC;
import java.util.List;
import javax.annotation.Resource;
+import org.lambico.spring.dao.hibernate.dao.EntityTCDao;
/**
*
@@ -29,8 +29,8 @@
*/
public class HibernateGenericBusinessDaoTest extends BaseTest {
- @Resource
- private EntityTCBusinessDao entityTCBusinessDao;
+ @Resource(name="entityTCBusinessDao")
+ private EntityTCDao entityTCBusinessDao;
public void testStoreRetrieve() {
EntityTC entity = new EntityTC();
=======================================
---
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/bo/EntityTCBusinessDao.java
Sat Feb 6 03:14:05 2010
+++
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/bo/EntityTCBusinessDao.java
Sun Mar 6 01:19:55 2011
@@ -18,15 +18,106 @@
package org.lambico.spring.dao.hibernate.bo;
+import java.util.Collection;
+import java.util.List;
import org.lambico.spring.dao.hibernate.po.EntityTC;
import org.lambico.dao.spring.BusinessDao;
import org.lambico.spring.dao.hibernate.HibernateGenericBusinessDao;
+import org.lambico.spring.dao.hibernate.dao.EntityTCDao;
+import org.springframework.beans.factory.annotation.Qualifier;
/**
*
* @author Jacopo Murador <jacopo.murador at seesaw.it>
*/
@BusinessDao
-public class EntityTCBusinessDao extends
HibernateGenericBusinessDao<EntityTC, Long>{
+@Qualifier("entityTCBusinessDao")
+public class EntityTCBusinessDao extends
HibernateGenericBusinessDao<EntityTC, Long> implements EntityTCDao {
+
+ @Override
+ public List<EntityTC> findByFieldOne(String value) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC>
findByFieldOneAndFieldTwoAndFieldThreeWithName(String one, String two,
+ String three) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> findByFieldTwo(String value) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> findByFieldThree(String value) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> findByFieldOneAndFieldTwo(String one, String
two) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> findByOrderByFieldOne() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> findByOrderByFieldTwo() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> findByOrderByFieldOneAndFieldTwo() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public EntityTC findByFieldOneOrderByFieldTwo(String one) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> findByOrderByFieldOne(int firstResult, int
maxResults) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> searchAllOrderByFieldOne(int firstResult, int
maxResults) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Long countByFieldOne(String value) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Integer countByFieldTwo(String two) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Integer countByFieldOneAndFieldThree(String one, String three) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Long maxByFieldOne(String value) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> searchByFieldOneCollection(Collection<String>
values) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<EntityTC> searchByFieldOneArray(String[] values) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
=======================================
---
/lambico-spring-hibernate/src/test/resources/applicationContext_test.xml
Fri Mar 4 09:00:01 2011
+++
/lambico-spring-hibernate/src/test/resources/applicationContext_test.xml
Sun Mar 6 01:19:55 2011
@@ -26,8 +26,9 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:lambico="http://www.lambico.org/schema/lambico"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+ http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.lambico.org/schema/lambico
http://www.lambico.org/schema/lambico.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">