-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Annotations conflicting with serialization
PostPosted: Tue Oct 23, 2007 6:55 am 
Beginner
Beginner

Joined: Tue Oct 05, 2004 5:15 am
Posts: 23
I have custom serialization in parts of my domain model.
To support this, several members are transient at the java modifier level (i.e, not @Transient).
However, outside of standard java serialization, I need these members to be persisted by hibernate.

It seems that this isn't supported - and the spec backs this up:


"Mapping annotations cannot be applied to fields or properties that are transient or Transient."

and

"All non-transient instance variables that are not annotated with the Transient
annotation are persistent."

So it looks like I'm stuffed. The JPA dudes obviously thought it was a great idea to mix serialization and persistence concerns :o(

So the question: Is there any nifty way to get round this in Hibernate? What I want is for a transient member variable to be persisted.

The alternative is very unattractive: Knock out the transients and use Externalizable (which is going to be a big fat pain).

Many thanks,

Dave


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 23, 2007 3:06 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I'm afraid there is no solution for you.
FTR I was against linking transient and @Transient, but the EG majority was for it for ease of use considerations.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 24, 2007 4:12 am 
Beginner
Beginner

Joined: Tue Oct 05, 2004 5:15 am
Posts: 23
emmanuel wrote:
I'm afraid there is no solution for you.
FTR I was against linking transient and @Transient, but the EG majority was for it for ease of use considerations.


Thanks for the clarification - at least I know where I stand now :o)

Thanks,

Dave


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.