-->
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: One-to-one problem
PostPosted: Mon Jun 06, 2005 11:52 am 
Newbie

Joined: Mon May 30, 2005 11:20 pm
Posts: 9
Location: Brasil
I get this message when I try to insert the second class (child).
But the Id of the Child is a foreign key to the Parent Id, then the Id need to be the same and when I try to insert I receive this:

NHibernate.ADOException: Could not save object ---> NHibernate.HibernateException: The generated identifier is already in use: [SisImob.Database.ClienteEndereco#28] at NHibernate.Impl.SessionImpl.DoSave(Object obj, Object id, IClassPersister persister, Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything) at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction action, Object anything) --- End of inner exception stack trace --- at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction action, Object anything) at NHibernate.Impl.SessionImpl.Save(Object obj) at SisImob.Database.Services.WsCliente.InserirClienteFisico(Cliente cl, ClienteFisico cf, ClienteConjuge cj, ClienteEndereco cend) in E:\Projetos\VisualC#\SisImob\SisImob\Services\WsCliente.cs:line 34

Anyone has one idea?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 2:08 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
You are apparently saving two objects of the same class with the same id. Why are you doing this? Maybe you need to call update the second time?


Top
 Profile  
 
 Post subject: No problem
PostPosted: Mon Jun 06, 2005 8:01 pm 
Newbie

Joined: Mon May 30, 2005 11:20 pm
Posts: 9
Location: Brasil
No! I had 2 classes.

But I find the problem, I don't get to make work the bidirecional one-to-one, but the unidirectional one-to-one works now.

The problem description is in the topic forum Mapping one-to-one, that is a little below in the general Support. Give a look there, you will understand what I was trying to do.

But now IT WORKS AEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

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