Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » can't create a new object(is it a bug?)
can't create a new object [message #651481] Mon, 31 January 2011 10:41 Go to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
hi all Very Happy
first, sorry about my english Embarrassed
i don't know if its a bug or not, but here's my problem: ig have these three classes:

Cliente: http://pastie.org/1501994 (yes, cliente has id, but is not shown)
GrupoTelefone: http://pastie.org/1501995
Telefone: http://pastie.org/1501996

when i try to save a NEW 'cliente', eclipselink says that the fields to insert on grupotelefone table is null..so, looking at the grupotelefone table, it has only an Id, which is referenced in other tables...but, being a new grupotelefone, he hasn't id (the database generates a new one) and this way, all the fields (only id) is null...
is there a configuration to disable this verification or something like?
thanks in advice

Re: can't create a new object [message #651500 is a reply to message #651481] Mon, 31 January 2011 13:02 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

I cannot see any obvious issues with the entities, other than using cascade.persist with cascade.all unneccessarily. Calling grupotelefone_id = new GrupoTelefone(); within ClienteFornecedor might cause extra GrupoTelefone entities to be persisted, but I'm not sure its related to this problem.

Can you post the code you are using to persist and commit these entities, as well as the log with the <property name="eclipselink.logging.level" value="FINEST"/> property set?

Best Regards,
Chris
Re: can't create a new object [message #651513 is a reply to message #651500] Mon, 31 January 2011 13:57 Go to previous messageGo to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
here is how i persist:
http://pastie.org/1514673
i persist with saveOrUpdate method (not the persistEntity!)
but call new GrupoTelefone didn't cause any extra entities persisted.

here's my configuration of entityManager: http://pastie.org/1514676
Re: can't create a new object [message #651545 is a reply to message #651481] Mon, 31 January 2011 15:44 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I'm not sure it is possible to insert into a table with no columns in it, other than a generated id. Perhaps add another field, or do not use IDENTITY id generation, use TABLE or SEQUENCE instead.

I checked, and on MySQL at least an empty insert is possible with an identity column, so I think you are correct, and we should not be throwing this error. Please log a bug for this and vote for it.


James : Wiki : Book : Blog : Twitter
Re: can't create a new object [message #651584 is a reply to message #651545] Mon, 31 January 2011 17:57 Go to previous message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
edit: https://bugs.eclipse.org/bugs/show_bug.cgi?id=335885

[Updated on: Mon, 31 January 2011 18:03]

Report message to a moderator

Previous Topic:Multiple Mapping-Files in PersistenceUnit
Next Topic:stale data refreshed after a size()?
Goto Forum:
  


Current Time: Tue Apr 16 20:42:06 GMT 2024

Powered by FUDForum. Page generated in 1.03983 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top