users@glassfish.java.net

Problemas accessing my persistence unit entity beans

From: Daniel Ortega Segura <daniel.ortega_at_gmail.com>
Date: Wed, 29 Aug 2007 17:24:17 +0200

 Hi there,
I've been the whole day googling but I've been unable to find a solution for
my problem; let's see if I can get some help here.

I've got all of my bussiness objects in a project named hidra3-core; they're
all entity beans and are well mapped using JPA + Spring 2.0 (with Toplink's
implementation).
I did all the ORM mapping and tested extensively using Junit tests
(extending from AbstractAspectjJpaTests). ALL of the tests passed without
problems.

I've got another project, called hidra3-web, which depends on the previously
mentioned hidra3-core project. Everything is configured via maven2 and I've
checked several times I can access anything I want of the core project from
the web project (any class, any entity bean, any xml file ...).

I made a simple jsp test page (which invoked one of my DAO's via a Struts2
Action) to check if the core project was well integrated; at the end, a
persist() method is invoked, and that persist() method produces this error:
[CODE]
Driver: Oracle JDBC driver Version: 9.2.0.8.0
[TopLink Info]: 2007.08.27 01:34:29.918--ServerSession
(22940715)--Thread(Thread[btpool0-2,5,main])--file:/C:/Documents%20and%20Settings/dosegura/.m2/repository/es/uc3m/hidra/hidra3-core/2.0-SNAPSHOT/hidra3-
core-2.0-SNAPSHOT.jar-hidra3-pu login successful
2007-08-27 13:34:29.980::WARN: EXCEPTION
javax.servlet.ServletException: Object: es.uc3m.hidra.domain.Group_at_51630a is
not a known entity type.
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java
:518)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatc
her.java:421)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
ServletHandler.java:1041)
....[/CODE]


Here is my applicationContext.xml

[CODE]<bean id="entityManagerFactory" class="
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
<property name="showSql" value="true" />
<property name="databasePlatform" value="
oracle.toplink.essentials.platform.database.oracle.OraclePlatform" />
</bean>
</property>
<property name="loadTimeWeaver">
<bean class="
org.springframework.instrument.classloading.SimpleLoadTimeWeaver" />
</property>
</bean>

<bean id="dataSource" class="
org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@xxx.xxx.xx:1521:bdhidrap" />
<property name="username" value="xxx" />
<property name="password" value="xxx" />
</bean>

<bean id="transactionManager" class="
org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory"
ref="entityManagerFactory" />
<property name="dataSource" ref="dataSource" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />[/CODE]

And here is my persistence.xml

[CODE]<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="hidra3-pu"
transaction-type="RESOURCE_LOCAL">
<provider>
oracle.toplink.essentials.PersistenceProvider
</provider>
<properties>
<property name="toplink.logging.level" value="FINE" />
<!-- Provider-specific connection properties -->
<property name="toplink.target-database" value="Oracle" />
<property name="toplink.jdbc.driver"
value="oracle.jdbc.OracleDriver" />
<property name="toplink.jdbc.url"
value="jdbc:oracle:thin:@xxxx.xxxx.xx:1521:bdhidrap" />
<property name="toplink.jdbc.user" value="xxx" />
<property name="toplink.jdbc.password" value="xxx" />
</properties>
</persistence-unit>

</persistence>[/CODE]

I double checked this files were read and loaded from the web project.
Besides, before the error I've got lots of:

[TopLink Config]: 2007.08.27
01:34:09.979--ServerSession(22940715)--Thread(Thread[main,5,main])--The
alias name for the entity class [class es.uc3m.hidra.domain.Type] is being
defaulted to: Type.

So, at least at one point, it really reads all my Entities and recognize
them before the error.

I'm really confused and do not know what to do. Let me know if you need more
data to catch my error.
Any help you could provide me would be greatly appreciated

Thanks in advance

-- 
Daniel Ortega Segura
Analista/Instructor de Software Java EE
Grupo Salenda S.L. - www.salenda.es
Avd. Rey Juan Carlos I, 92. 28916 - Leganés (Madrid).
T: 91 101 0607 ext. 301 / F: 91 101 0608
M: +34.627.56.76.85
E: daniel.ortega_at_gmail.com