Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How to manage two entities with the same name in one project?
How to manage two entities with the same name in one project? [message #1096042] Tue, 27 August 2013 22:26 Go to next message
Francisco Pardo is currently offline Francisco PardoFriend
Messages: 1
Registered: August 2013
Junior Member

I'm stuck with the following problem:

I have a project with three different sets of entities, all of them stored in three different packages (databaseOne, databaseTwo, databaseThree). The three databases are pretty similar, being just three versions of one data model. The entities in databaseOne and databaseThree share the same names. I'm trying to make a program to export data between the three of them, but in runtime, the program fails to instantiate equivalent objects of databaseOne and databaseThree (for example, the employee entity). This is the exception I've got:

Internal Exception: java.sql.SQLIntegrityConstraintViolationException: Column 'id_empresas' cannot be null
Error Code: 1048
Call: INSERT INTO empresas (id_empresas, acronimo, giro, razon_social) VALUES (?, ?, ?, ?)
bind => [4 parameters bound]
Query: InsertObjectQuery(persistencia.avanta5.Empresas[ idEmpresas=null ])
[EL Warning]: 2013-08-27 18:16:46.622--UnitOfWork(515397576)--java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: persistencia.avanta5.Empresas[ idEmpresas=null ].
Este fallo:00.000.000-0
el down fue en 00.000.000-0

It appears that the field "idEmpresas" was not filled... but I did fill it. In fact, the value "00.000.000-0" is the value from such field. I'm passing all the values from one databaseOne.object to databaseThree.object using Dozer, and when I got this, I tried setting it directly, with same result. Anybody does have any ideas? I'm using a facade that does work between databaseTwo and any other of the two, so I know it's not the process.
Re: How to manage two entities with the same name in one project? [message #1096670 is a reply to message #1096042] Wed, 28 August 2013 17:55 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1300
Registered: July 2009
Senior Member
What you have posted looks like two different issues. The first is the SQL exception that occurs trying to insert a null id_empresas field, the second is a warning printed from EclipseLink when it throws an IllegalStateException on finding a new entity that is referenced by another.

The problems may be related, but aren't exactly the same. Check that your conversion process is maintaining object identity and that the object graph you are passing to the EntityManager merge or persist calls is fully populated. The problem might not be in the object passed directly, but buried in its references.

Best Regards,

Previous Topic:Moxy is not honoring "type" attribute in xml-element tag in EclipseLink 2.4.2
Next Topic:Regression 2.4.1 -> 2.4.2
Goto Forum:

Current Time: Sun Jun 24 15:18:36 GMT 2018

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

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

Back to the top