My problem is that i need to add a onetoone relationship between User.java
POJO and my POJO Universidad.java wich is also an Entity. I'm getting this
error when i run mvn jetty:run-war.
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'roleDao' defined in class path resource
[applicationContext-dao.xml]: Cannot resolve reference to bean
'sessionFactory' while setting bean property 'sessionFactory'; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'sessionFactory' defined in class path resource
[applicationContext-dao.xml]: Invocation of init method failed; nested
exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on
com.aneaes.app.model.User.universidad references an unknown entity:
com.aneaes.app.model.Universidad
I've registered my pojo in hibernate.cfg.xml and applicationContext.xml. The
two xml's look like:
hibernate.cfg.xml
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate
Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<mapping class="com.aneaes.app.model.User"/>
<mapping class="com.aneaes.app.model.Role"/>
<mapping class="com.aneaes.app.model.Universidad"/>
<mapping class="com.aneaes.app.model.Facultad"/>
<mapping class="com.aneaes.app.model.Sede"/>
<mapping class="com.aneaes.app.model.Carrera"/>
<mapping class="com.aneaes.app.model.CarreraPostG"/>
</session-factory>
</hibernate-configuration>
applicationContext.xml
<!-- Add new DAOs here -->
<bean id="universidadDao"
class="com.aneaes.app.dao.hibernate.GenericDaoHibernate">
<constructor-arg value="com.aneaes.app.model.Universidad"/>
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
....
....
<bean id="universidadManager"
class="com.aneaes.app.service.impl.GenericManagerImpl">
<constructor-arg>
<bean class="com.aneaes.app.dao.hibernate.GenericDaoHibernate"
autowire="byType">
<constructor-arg value="com.aneaes.app.model.Universidad"/>
</bean>
</constructor-arg>
</bean>
I've also update my pom.xml with the exclusions, and it looks like:
pom.xml
<dependency>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-${web.framework}</artifactId>
<version>${appfuse.version}</version>
<type>war</type>
<exclusions>
<exclusion>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-data-common</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-${web.framework}</artifactId>
<version>${appfuse.version}</version>
<type>warpath</type>
<exclusions>
<!-- This exclusion and the dependency following this one
allow DAO framework switching. -->
<!-- You only need these if you want to use JPA or iBATIS.
See APF-565 for more information. -->
<!-- It does no harm to leave it in for Hibernate, but it's
not needed. -->
<exclusion>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-hibernate</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-${dao.framework}</artifactId>
<version>${appfuse.version}</version>
<exclusions>
<exclusion>
<groupId>org.appfuse</groupId>
<artifactId>appfuse-data-common</artifactId>
</exclusion>
</exclusions>
</dependency>
My User.java POJO looks like:
@OneToOne()
public Universidad getUniversidad() {
return universidad;
}
public void setUniversidad(Universidad universidad) {
this.universidad = universidad;
}
Removing the @OneToOne() my application works...
What i'm doing wrong?? i've tried almost everything that i've read at the
forum but the problem persists
--
View this message in context:
http://www.nabble.com/One-to-one-annotation-drop-unknown-Reference-to-an-entity.-tp23041089s2369p23041089.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]