This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Mike Anna
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mike Anna
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic