-->
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: Can i use an Interface as a pojo object to be persistent?
PostPosted: Sun Mar 18, 2007 11:19 am 
Newbie

Joined: Fri Feb 17, 2006 10:56 pm
Posts: 2
i try to use an interface to be persistent.
in hbm.xml :
<class name="man" table="t_person">

name will be ths class name that implements the interface.

can i do that?

and how can i write serialVersionUID? will be useable?


also i want to ask :if i do like this,is some hibernate feature will be lose?

BTW:i use hibernate 3.2.1GA


thanks!!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 9:20 am 
Newbie

Joined: Fri Feb 17, 2006 10:56 pm
Posts: 2
up


Top
 Profile  
 
 Post subject: Re: Can i use an Interface as a pojo object to be persistent
PostPosted: Mon Mar 19, 2007 9:29 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
Eric Liu wrote:
i try to use an interface to be persistent.
in hbm.xml :
<class name="man" table="t_person">

name will be ths class name that implements the interface.

can i do that?


no. hibernate cannot guess what implementing class you're using nor can it instantiate your interface. you can use an interface like a normal interface, your hbm just needs to map to a class.

Quote:

and how can i write serialVersionUID? will be useable?


hibernate doesn't serialize anything, nor does it use the serialVersionUID

Quote:
also i want to ask :if i do like this,is some hibernate feature will be lose?

BTW:i use hibernate 3.2.1GA


thanks!!!


no

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


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.