Skip to main content



      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 05:41 Go to next message
Eclipse UserFriend
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 08:02 Go to previous messageGo to next message
Eclipse UserFriend
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 08:57 Go to previous messageGo to next message
Eclipse UserFriend
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 10:44 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: can't create a new object [message #651584 is a reply to message #651545] Mon, 31 January 2011 12:57 Go to previous message
Eclipse UserFriend
edit: https://bugs.eclipse.org/bugs/show_bug.cgi?id=335885

[Updated on: Mon, 31 January 2011 13:03] by Moderator

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


Current Time: Wed Jul 02 23:57:30 EDT 2025

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

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

Back to the top