-->
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: question reagrding CaterogizedItem in HIA 0.95
PostPosted: Wed Oct 12, 2005 9:13 am 
Beginner
Beginner

Joined: Wed Feb 23, 2005 10:26 am
Posts: 22
I was going throught the samples of
Category
Item
CategorizedItem

If is save the category ,its fine

In another case if i save the category and the Item it is fine

In another case I load the saved category and the Item and save the
Catgorized item, it is fine

In another case when i try to save a new instance of category, instance of item and instance of categorizedItem in single save
i.e
Catgeory catgeory = new Catgeory();
//fill attributes

Item item = new Item();
// fill attributes

String user= "james";
CategorizedItem item = new CategorizedItem(user,catgeory,item);
// over here you do the linking stuff in the example
session.save(catgeory);

I get errors in the link table saving it mentions that the
Caused by: java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("SCOTT"."CATEGORIZED_ITEM"."CATEGORY_ID")


In the CategorizedItem Class
====================
public CategorizedItem(String username, Category category, Item item) {
this.username = username;

this.category = category;
this.item = item;

// Set key values
this.id.categoryId = category.getId();
this.id.itemId = item.getId();

// Guarantee referential integrity
category.getCategorizedItems().add(this);
item.getCategorizedItems().add(this);
}


this.id.categoryId = category.getId();
this.id.itemId = item.getId();
over hear since the category is not saved and the item is not saved, the ids are null and as a result its not generating the sql properly. to insert in the link table

Is there something else i need to do ? to make sure its capable of doing this


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