-->
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
PostPosted: Thu Jan 12, 2006 5:31 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
Hi We have developed program using Joined Subclass feature of hibernate.

First Class:
--------------------------
class Person{
String id; // this is primary key
String name;

get & set methods for both the properties

}

Second class:
---------------------------
class Order extends Person{

String orderid, // this is primary key or Unique key
String ordername;
get & set methods for both the properties
}

Maping file:
----------------------------------------------------------------
<hibernate-mapping default-lazy="false" auto-import="false">
<class name="Person" dynamic-update="false" dynamic-insert="false">
<id name="id" type="String" column="Person_ID">
// Assigned key
</id>
<property name="name" type="string" />

<joined-subclass name="Order" table="Order" dynamic-update="false" dynamic-insert="false">
<key column="Order_ID"/>
<property name="orderid" type="string" not-null="true"/>
<property name="ordername" type="string"/>
</joined-subclass>

</class>
</hibernate-mapping>
-------------------------------------------------------------------------

My intention is :
1) First I inserted a record in a Person with his details, it is sucessfully inserted in DB.

2) When I am trying to insert the data for Order I am getting an error ( JDBC batch operation), I am setting the values for the following fileds

1. id=1 // inherited from parent class
2. Orderid=1;
3. Ordername="myorder";

Can you please suggest what is the wrong in this and solution for the same.

We are in middle of the project, your help is more appreciated.

Regards,
Srinivas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 12, 2006 5:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
this is the tools forum, go to the user forum for such questions.

_________________
Max
Don't forget to rate


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.