|
|
|
|
|
Re: [Texo/Hibernate] TransientObjectException: object references an unsaved transient instance [message #699671 is a reply to message #699592] |
Fri, 22 July 2011 04:12 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Mike,
I don't think it is a specific Texo problem (cascades have different meanings and there are pros/cons to different
settings in different situations). But maybe the mapping can be generated in such a way that this problem does not occur
directly, although afaics the orm.xml is fine.
Is this something I can easily try myself? If you can send me a zipped project directly by email with a testcase I can
run then I can try to reproduce this.
There is lots of info on jpa/orm on the internet. The spec is quite readable, specifically the part where the
annotations are explained, chapters 11 and 12 (see attached):
http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html
gr. Martin
On 07/21/2011 11:18 PM, Mike Cooper wrote:
> Thanks Martin. I've traced the problem down to this:
>
> Class: AbstractEntityTuplizer
>
>
> public Serializable getIdentifier(Object entity, SessionImplementor session) {
> final Object id;
> if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
> id = entity;
> }
> else {
> if ( idGetter == null ) {
> if (identifierMapperType==null) {
> throw new HibernateException( "The class has no identifier property: " + getEntityName() );
> }
> else {
> id = mappedIdentifierValueMarshaller.getIdentifier( entity, getEntityMode(), session );
> }
> }
> else {
> id = idGetter.get( entity );
> }
> }
>
> try {
> /* RETURNS null => */ return (Serializable) id;
> }
>
>
> The "id" var is returned as null. Back up the stack this causes hibernate to mark the class as transient.
>
> I'm definitely out of my depth at this point and not sure how to proceed. Do you think this is related to the texo
> generated orm.xml or some other texo generated file? Or is this likely to be something in my code or hibernate itself?
> What's a good reference doc for the orm.xml syntax? Maybe I can dig around there.
>
> mike
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
Re: [Texo/Hibernate] TransientObjectException: object references an unsaved transient instance [message #700119 is a reply to message #700032] |
Fri, 22 July 2011 20:42 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Yes please do enter a bugzilla, I am surprised as persist, merge and refresh are the most common one, the other ones
(remove, refresh, detach) make less sense.If you enter a bugzilla then I will add refresh and detach, remove just does
not make sense for most many-to-ones...
gr. Martin
On 07/22/2011 08:29 PM, Mike Cooper wrote:
> I have it working now. If I manually edit orm.xml and replace all of the <orm:cascade-.../> entries with
> <orm:cascade-all/> it works fine. Looking back at how my code used Teneo prior to Texo I also set "cascade=all" so it
> makes sense now.
>
> So how do I get Texo to use cascade-all instead of cascade-merge, etc? Should I file an enhencement/bug in bugzilla?
>
> Cheers,
> mike
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.02274 seconds