aspose file tools*
The moose likes Object Relational Mapping and the fly likes List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "List "key Column" and "List Index" values null." Watch "List "key Column" and "List Index" values null." New topic
Author

List "key Column" and "List Index" values null.

Mike Anna
Ranch Hand

Joined: Jul 08, 2007
Posts: 117
hi,
I have this scenarion. One Conference can have many Users. So,
I mapped my Conference class like this :

and my Users class like this :

Now, the Conf_id and the idx columns are being updated as null and .. I have no clue why.



Heres the code that tests the updations:


Any help, greatly appreciated.

Rgds
Mike Anna
Ranch Hand

Joined: Jul 08, 2007
Posts: 117
Hi,

Should I have actually mapped Conference in Users mapping as a component or.. may be just modify it into a many to one association.?

have I missed giving any details ?


rgds
[ October 15, 2007: Message edited by: Mike Anna ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

I don't see a FK mapping of conf_Id in your User class, so how would Hibernate know to put a value into that field?

Also, be careful about id naming and capitalization. I got confused how in User you have "id" to a column called "ID" and in the conference it was "conf_Id", the normal default way, if you can change the database is to call the attribute in the class all lower case "id" and allow Hibernate to automatically combine the class name and id name like Class=Mark and id is "id" Hibernate will give you "mark_id" as the PK field name.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mike Anna
Ranch Hand

Joined: Jul 08, 2007
Posts: 117
Thanks Mark, for replying.
I am fairly new to hibernate.
I don't see a FK mapping of conf_Id in your User class, so how would Hibernate know to put a value into that field?

and how would I do that ?
map the conf_Id as a propertyu in the component mapping of the Users class ?

Right about the naming conventions, I will take care.

Rgds
[ October 15, 2007: Message edited by: Mike Anna ]
 
Don't get me started about those stupid light bulbs.
 
subject: List "key Column" and "List Index" values null.