Added:
/lambico-core/src/main/java/org/lambico/dao/AutomaticDao.java
Modified:
/lambico-spring-hibernate/src/main/java/org/lambico/spring/dao/hibernate/HibernateDaoBeanCreator.java
/lambico-spring-hibernate/src/main/java/org/lambico/spring/dao/hibernate/HibernateDaoInstrumentation.java
=======================================
--- /dev/null
+++ /lambico-core/src/main/java/org/lambico/dao/AutomaticDao.java Sun Mar
6 23:35:44 2011
@@ -0,0 +1,25 @@
+/**
+ * Copyright (C) 2009 Lambico Team <lucio.b...@gmail.com>
+ *
+ * This file is part of Lambico Core.
+ *
+ * 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.dao;
+
+/**
+ * A marker interface for the DAOs that have methods that must be
authomatically
+ * generated.
+ */
+public interface AutomaticDao {
+}
=======================================
---
/lambico-spring-hibernate/src/main/java/org/lambico/spring/dao/hibernate/HibernateDaoBeanCreator.java
Sat Feb 6 03:14:05 2010
+++
/lambico-spring-hibernate/src/main/java/org/lambico/spring/dao/hibernate/HibernateDaoBeanCreator.java
Sun Mar 6 23:35:44 2011
@@ -18,12 +18,15 @@
package org.lambico.spring.dao.hibernate;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import javax.persistence.Entity;
import org.apache.log4j.Logger;
+import org.lambico.dao.AutomaticDao;
import org.lambico.dao.generic.Dao;
import org.lambico.spring.xml.ContextUtils;
import org.lambico.spring.xml.DaoBeanCreator;
@@ -130,14 +133,14 @@
BeanDefinition baseDaoBD =
registry.getBeanDefinition(genericDaoName);
Class<?>[] genericDaoInterfaces =
Class.forName(baseDaoBD.getBeanClassName()).getInterfaces();
+ List<Class<?>> newGenericDaoInterfaces =
+ new ArrayList<Class<?>>(genericDaoInterfaces.length + 2);
+
newGenericDaoInterfaces.addAll(Arrays.asList(genericDaoInterfaces));
if (daoInterface != null) {
- Class<?>[] newGenericDaoInterfaces = new
Class<?>[genericDaoInterfaces.length + 1];
- System.arraycopy(genericDaoInterfaces, 0,
- newGenericDaoInterfaces, 0,
genericDaoInterfaces.length);
- newGenericDaoInterfaces[genericDaoInterfaces.length] =
daoInterface;
- genericDaoInterfaces = newGenericDaoInterfaces;
- }
- return genericDaoInterfaces;
+ newGenericDaoInterfaces.add(daoInterface);
+ }
+ newGenericDaoInterfaces.add(AutomaticDao.class);
+ return newGenericDaoInterfaces.toArray(new
Class<?>[newGenericDaoInterfaces.size()]);
}
/**
=======================================
---
/lambico-spring-hibernate/src/main/java/org/lambico/spring/dao/hibernate/HibernateDaoInstrumentation.java
Fri Mar 4 09:45:19 2011
+++
/lambico-spring-hibernate/src/main/java/org/lambico/spring/dao/hibernate/HibernateDaoInstrumentation.java
Sun Mar 6 23:35:44 2011
@@ -85,7 +85,7 @@
* @return The result of the execution of the finder method.
* @throws Throwable In case of error.
*/
- @Around(value = "execution(* *(..)) &&
target(org.lambico.dao.generic.GenericDao)
&& !target(org.lambico.spring.dao.hibernate.HibernateGenericBusinessDao)")
+ @Around(value = "target(org.lambico.dao.generic.GenericDao) &&
target(org.lambico.dao.AutomaticDao)")
public Object executeFinder(final ProceedingJoinPoint pjp) throws
Throwable {
Object result = null;
final GenericDao target = (GenericDao) pjp.getTarget();