users@glassfish.java.net

Re: Ejb3 Entity graph serialization problem?

From: <glassfish_at_javadesktop.org>
Date: Mon, 22 Sep 2008 04:46:40 PDT

Description of the problem:

When calling from an other EAR on the same appserver, returning an
ejb3 entity bean from a remote ejb call which has a many-to-one lazy
reference makes all the entity's properties be null at the caller
point.


Steps to reproduce:

0. Install Glassfish v2ur2 or Sun Appserver 9.1 (verified on both) and Maven 2
1. prepare the JPA resources:
asadmin create-jdbc-connection-pool \
--datasourceclassname org.apache.derby.jdbc.EmbeddedDataSource \
--property databaseName=\$\{com.sun.aas.instanceRoot\}/databases/eartest:\
connectionAttributes=\;create\\=true \
eartest
asadmin ping-connection-pool eartest
asadmin create-jdbc-resource --connectionpoolid=eartest jdbc/eartest

2. unpack the demo projects hold in eartest-ejb3weaving.tgz
3. do 'mvn install' in all 4 projects in that order: eartest-called,
eartest-called-ear, eartest-called, eartest-caller-ear
4. do 'mvn asadmin:deploy' in eartest-called-ear and eartest-caller-ear
5. do a HTTP GET on http://localhost:8080/eartest-caller
6. check your appserver's server.log file, the entity called
LazyAddress will show its properties being null


Note:

The problem is *not* about an entity's lazy and not fetched property
being null out of the transaction boundaries. The entity's lazy
property is correctly prefetched before returning, but the problem
even exists if the entity is created with the new operator before
returning.
[Message sent by forum member 'kjozsa' (kjozsa)]

http://forums.java.net/jive/thread.jspa?messageID=300727