Hi, Call e.getRelationship().size() before the end of the tx Le 15 oct. 2012 22:18, "potgieterdl" <[email protected]> a écrit :
> Hi All, > > I`m running tomee rest 1.5.0 and have swapped openjpa to hibernate. > I`m having a issue is my rest service on returning a List<Customer> which > is > throwing a lazy load exception : > > org.hibernate.LazyInitializationException: could not initialize proxy - no > Session > at > > org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:180 > > > This happens because the jpa session closes before the object conversion to > xml/json happens. so it cant load the mapped entities. > > I`m looking for suggestions here around possible solutions. The only 1 i > can > think of is creating DTO`s and mapping the values to them, but creates alot > of duplicaiton. Issue is i do need to know the primary key for the mapped > entity to send through. > > Is there any other way that this can be achieved? > > Thanks > Derick > > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/Rest-and-lazy-loaded-JPA-2-0-hibernate-entities-tp4658042.html > Sent from the OpenEJB User mailing list archive at Nabble.com. >
