-->
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.  [ 2 posts ] 
Author Message
 Post subject: joined-subclass with a unique constraint in the base class
PostPosted: Thu Jan 26, 2006 3:27 pm 
Newbie

Joined: Wed Jan 04, 2006 10:01 pm
Posts: 17
I need to extend a class A with a few attributes in a separate table, so I chose the joined-subclass model. Let say I have a basic application managing Table A and class A and additionnal modules. The basic application is the one creating objects and additionnal modules add attributes if and when needed.

So if table A contains an entry with a key "1" and if I want to add attribute in module B, can I just do the folowing ?
Code:
ClassB b= new ClassB();
b.setKey(1);


add attributes to b and then

Code:
session.saveOrUpdate(b);


if not how would I do it?

Philippe



Hibernate version:
Hibernate version 3.1
Mapping documents:
Code:
<joined-subclass extends="ClassA" table="AB" name="ClassB" lazy="true" >

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject: suggestion does not work
PostPosted: Thu Jan 26, 2006 8:09 pm 
Newbie

Joined: Wed Jan 04, 2006 10:01 pm
Posts: 17
I tried and it does not work.

Hibernate is either generating two INSERT statements (table A and table AB) or two UPDATE statements where in fact I need an UPDATE on table A and a CREATE on table AB.

is there a way to obtain this extension mecanism?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.