-->
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.  [ 1 post ] 
Author Message
 Post subject: List's "key Column" and "List Index" = n
PostPosted: Mon Oct 15, 2007 4:43 am 
Newbie

Joined: Tue Mar 20, 2007 4:40 am
Posts: 6
Location: India
Hibernate version:
3.x
Mapping documents:

<class name = "com.jd.hibernate.associations.Conference" table = "TEST_JD_CONFERENCE" >
<id name = "conf_Id" column = "conf_Id"> <generator class = "identity"/>
</id>
<property name = "name" column = "Name" type
= "java.lang.String" /> ...<!--other props-->..

<list name = "usersInConference"inverse="true" cascade = "save-update">
<key column="conf_Id" />
<list-index column="idx"></list-index>
<one-to-many class = "com.jd.hibernate.associations.Users" />
</list>
</class>

<class name = "com.jd.hibernate.associations.Users" table = "TEST_JD_USERS" discriminator-value="Users">
<id name = "id" column = "ID" type = "int">
<generator class = "increment"/>
</id>
<discriminator column = "Users_Type" type = "java.lang.String" />
<property name = "userType" type = "java.lang.String" column = "USERTYPE" />
..<!-- other properties --> ..
<component name="conference" class = "com.jd.hibernate.associations.Conference" >
<!-- mapping necessary only for the required attributes that will be saved along with this -->
<property name = "name" column = "Name" type = "java.lang.String" />
<property name = "desc" column = "Description" type = "java.lang.String" />
<property name = "startDate" column = "StartDate" type = "date" />
<property name = "endDate" column = "EndDate" type = "date" />
</component>
</class>


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

tx.begin();
Conference conf = new Conference();
Users users = new Users();
Users users1 = new Users();
List userList = new ArrayList(); users.setEmail("test@asd.com"); users.setFirtName("navnith"); users.setHomePhone(342); users.setLastName("M"); users.setPassword("navnith"); users.setUserType("S"); users.setWorkPhone(3214); users1.setEmail("test1@asd.com"); users1.setFirtName("11n1avnith"); users1.setHomePhone(11342); users1.setLastName("11M"); users1.setPassword("11navnith"); users1.setUserType("11S"); users1.setWorkPhone(11214); conf.setDesc("usersconfdesc"); conf.setEndDate(new Date(1,1,1)); conf.setName("Test for users"); conf.setStartDate(new Date()); users.setConference(conf); users1.setConference(conf); userList.add(users);
userList.add(users1); conf.setUsersInConference(userList); session.save(conf);


Full stack trace of any exception that occurs:

Name and version of the database you are using:
MS SQL

Now, the Conf_id and the idx columns are being updated as null and .. I have no clue why. Any pointers on what wrong I am doing ?

Rgds


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.