Added:
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/EntityTCTerTest.java
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/bo/EntityTCTerBusinessDao.java
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/daoter/EntityTCTerDao.java
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/poter/EntityTCTer.java
/lambico-spring-hibernate/src/test/resources/fixtures/EntityTCTer.yml
Modified:
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/BaseTest.java
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/HibernateDaoBeanCreatorTest.java
/lambico-spring-hibernate/src/test/resources/applicationContext_test.xml
=======================================
--- /dev/null
+++
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/EntityTCTerTest.java
Fri Mar 4 08:54:33 2011
@@ -0,0 +1,46 @@
+/**
+ * Copyright (C) 2009 Lambico Team <lucio.b...@gmail.com>
+ *
+ * This file is part of Lambico Spring - Hibernate.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.lambico.spring.dao.hibernate;
+
+import java.util.List;
+import javax.annotation.Resource;
+import org.lambico.spring.dao.hibernate.daoter.EntityTCTerDao;
+import org.lambico.spring.dao.hibernate.poter.EntityTCTer;
+
+/**
+ * Tests on generic DAO with DAOs and entities in multiple separated
packages.
+ *
+ * @author Lucio Benfante <lucio.b...@gmail.com>
+ * @version $Revision$
+ */
+public class EntityTCTerTest extends BaseTest {
+
+ @Resource
+ private EntityTCTerDao entityTCTerDao;
+
+ public void testDaoExists() {
+ assertNotNull(entityTCTerDao);
+ }
+
+ public void testAllSize() {
+ final List<EntityTCTer> result = entityTCTerDao.findAll();
+ assertSize(1, result);
+ EntityTCTer testCast = result.get(0);
+ }
+}
=======================================
--- /dev/null
+++
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/bo/EntityTCTerBusinessDao.java
Fri Mar 4 08:54:33 2011
@@ -0,0 +1,42 @@
+/**
+ * Copyright (C) 2009 Lambico Team <lucio.b...@gmail.com>
+ *
+ * This file is part of Lambico Spring - Hibernate.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.lambico.spring.dao.hibernate.bo;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.lambico.spring.dao.hibernate.HibernateGenericBusinessDao;
+import org.lambico.spring.dao.hibernate.daoter.EntityTCTerDao;
+import org.lambico.spring.dao.hibernate.poter.EntityTCTer;
+
+/**
+ * A DAO overriding a method of the base DAO.
+ *
+ * @author Lucio Benfante <lucio.b...@gmail.com>
+ */
+public class EntityTCTerBusinessDao extends
HibernateGenericBusinessDao<EntityTCTer, Long> implements EntityTCTerDao {
+
+ @Override
+ public List<EntityTCTer> findAll() {
+ final LinkedList<EntityTCTer> result =
+ new LinkedList<EntityTCTer>();
+ result.add(new EntityTCTer());
+ return result;
+ }
+
+}
=======================================
--- /dev/null
+++
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/daoter/EntityTCTerDao.java
Fri Mar 4 08:54:33 2011
@@ -0,0 +1,33 @@
+/**
+ * Copyright (C) 2009 Lambico Team <lucio.b...@gmail.com>
+ *
+ * This file is part of Lambico Spring - Hibernate.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.lambico.spring.dao.hibernate.daoter;
+
+import org.lambico.dao.generic.Dao;
+import org.lambico.dao.generic.GenericDao;
+import org.lambico.spring.dao.hibernate.poter.EntityTCTer;
+
+/**
+ * A DAO to be used for the tests of the generic DAO.
+ *
+ * @author <a href="mailto:lu...@benfante.com">Lucio Benfante</a>
+ * @version $Revision$
+ */
+@Dao(entity = EntityTCTer.class)
+public interface EntityTCTerDao extends GenericDao<EntityTCTer, Long> {
+}
=======================================
--- /dev/null
+++
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/poter/EntityTCTer.java
Fri Mar 4 08:54:33 2011
@@ -0,0 +1,75 @@
+/**
+ * Copyright (C) 2009 Lambico Team <lucio.b...@gmail.com>
+ *
+ * This file is part of Lambico Spring - Hibernate.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.lambico.spring.dao.hibernate.poter;
+
+import org.lambico.po.hibernate.EntityBase;
+import javax.persistence.Entity;
+
+/**
+ * An persistent object to be used for the tests of the generic DAO.
+ *
+ * @author <a href="mailto:lu...@benfante.com">Lucio Benfante</a>
+ * @version $Revision$
+ */
+@Entity
+public class EntityTCTer extends EntityBase {
+ private String fieldOne;
+ private String fieldTwo;
+ private String fieldThree;
+ private Long numericField;
+
+ /**
+ * Creates a new instance of EntityTC
+ */
+ public EntityTCTer() {
+ }
+
+ public String getFieldOne() {
+ return fieldOne;
+ }
+
+ public void setFieldOne(String fieldOne) {
+ this.fieldOne = fieldOne;
+ }
+
+ public String getFieldTwo() {
+ return fieldTwo;
+ }
+
+ public void setFieldTwo(String fieldTwo) {
+ this.fieldTwo = fieldTwo;
+ }
+
+ public String getFieldThree() {
+ return fieldThree;
+ }
+
+ public void setFieldThree(String fieldThree) {
+ this.fieldThree = fieldThree;
+ }
+
+ public Long getNumericField() {
+ return numericField;
+ }
+
+ public void setNumericField(Long numericField) {
+ this.numericField = numericField;
+ }
+
+}
=======================================
--- /dev/null
+++ /lambico-spring-hibernate/src/test/resources/fixtures/EntityTCTer.yml
Fri Mar 4 08:54:33 2011
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2009 Lambico Team <lucio.b...@gmail.com>
+#
+# This file is part of Lambico Spring - Hibernate.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+- &EntityTCTer-etc1
+ fieldOne: "one1"
+ fieldTwo: "two5"
+ fieldThree: "Three1"
+ numericField: 1
+- &EntityTCTer-etc2
+ fieldOne: "one2"
+ fieldTwo: "two4"
+ fieldThree: "Three2"
+ numericField: 2
+- &EntityTCTer-etc3
+ fieldOne: "one3"
+ fieldTwo: "two3"
+ fieldThree: "Three3"
+ numericField: 3
+- &EntityTCTer-etc4
+ fieldOne: "one4"
+ fieldTwo: "two2"
+ fieldThree: "Three4"
+ numericField: 4
+- &EntityTCTer-etc5
+ fieldOne: "one3"
+ fieldTwo: "two1"
+ fieldThree: "7hree5"
+ numericField: 5
=======================================
---
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/BaseTest.java
Mon Feb 15 09:17:05 2010
+++
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/BaseTest.java
Fri Mar 4 08:54:33 2011
@@ -24,6 +24,7 @@
import org.lambico.spring.dao.hibernate.po.EntityTCNoInheritance;
import org.lambico.spring.dao.hibernate.po.EntityTCWithoutDaoInterface;
import org.lambico.spring.dao.hibernate.pobis.EntityTCBis;
+import org.lambico.spring.dao.hibernate.poter.EntityTCTer;
import org.lambico.test.spring.hibernate.DBTest;
/**
@@ -35,7 +36,7 @@
@Override
public Class[] getFixtureClasses() {
- return new Class[]{EntityTC.class, EntityTCBis.class,
EntityTCWithoutDaoInterface.class,
+ return new Class[]{EntityTC.class, EntityTCBis.class,
EntityTCTer.class, EntityTCWithoutDaoInterface.class,
EntityTCNoInheritance.class, AuthorTC.class,
BookTC.class};
}
}
=======================================
---
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/HibernateDaoBeanCreatorTest.java
Sat Feb 6 23:39:31 2010
+++
/lambico-spring-hibernate/src/test/java/org/lambico/spring/dao/hibernate/HibernateDaoBeanCreatorTest.java
Fri Mar 4 08:54:33 2011
@@ -45,6 +45,6 @@
HibernateDaoBeanCreator instance = createInstance();
String interfacePackageName = "org.lambico.spring.dao.hibernate";
Set result = instance.getDaoInterfaces(interfacePackageName);
- assertEquals(6, result.size());
+ assertEquals(7, result.size());
}
}
=======================================
---
/lambico-spring-hibernate/src/test/resources/applicationContext_test.xml
Sat Feb 6 23:39:31 2010
+++
/lambico-spring-hibernate/src/test/resources/applicationContext_test.xml
Fri Mar 4 08:54:33 2011
@@ -55,12 +55,17 @@
<!-- Authomatic detection of persistent classes -->
<lambico:discover-persistent-classes
basePackage="org.lambico.spring.dao.hibernate.po" />
<lambico:discover-persistent-classes
basePackage="org.lambico.spring.dao.hibernate.pobis" />
+ <lambico:discover-persistent-classes
basePackage="org.lambico.spring.dao.hibernate.poter" />
<!-- Authomatic DAO definition from persistent classes -->
<lambico:define-daos
baseInterfacePackage="org.lambico.spring.dao.hibernate.dao"
baseEntityPackage="org.lambico.spring.dao.hibernate.po"/>
<lambico:define-daos
baseInterfacePackage="org.lambico.spring.dao.hibernate.daobis"
baseEntityPackage="org.lambico.spring.dao.hibernate.pobis"/>
-
+ <lambico:define-daos
baseInterfacePackage="org.lambico.spring.dao.hibernate.daoter"
+
baseEntityPackage="org.lambico.spring.dao.hibernate.poter"/>
+ <context:component-scan
base-package="org.lambico.spring.dao.hibernate.bo"/>
+
+ <bean id="entityTCTerDao"
class="org.lambico.spring.dao.hibernate.bo.EntityTCTerBusinessDao" />
<bean id="daos" parent="abstractDaoProvider">
<property name="proxyInterfaces">