-->
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: Joined Subclass problem
PostPosted: Thu Jan 12, 2006 5:50 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 19, 2006 5:36 am 
Newbie

Joined: Wed Jan 11, 2006 5:21 am
Posts: 14
Make sure that you have no duplicate record in Person table where id = 1.

When trying to insert a record into a subclass table, hibernate will also insert a record in the Person table. So make sure you have no duplicate.

Kind regards and thank you for rating.
Roy


Top
 Profile  
 
 Post subject: Create Schema
PostPosted: Thu Feb 09, 2006 10:12 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
Hi,

deployed small application in Jboss and Using

HibernateServiceMBean , but the hibernate is not creating database schema

can help , which attribute we have to specify in hibernate-service.xml file

Thanks


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.