|
Re: @OneToMany Annotation problem [message #900023 is a reply to message #899863] |
Fri, 03 August 2012 13:41 |
Chris Delahunt Messages: 1389 Registered: July 2009 |
Senior Member |
|
|
Hello,
Have you put annotations on properties and fields by chance? This might cause the mappings with the fetchtype set to EAGER to be ignored since they should be all on fields or all on properties. Try setting the EclipseLink log level to FINEST and search the logs for where the players and team mappings are processed to see what might be going on. This can be set using <property name="eclipselink.logging.level" value="FINEST"/>
Best Regards,
Chris
[Updated on: Fri, 03 August 2012 15:43] Report message to a moderator
|
|
|
Re: @OneToMany Annotation problem [message #900064 is a reply to message #899863] |
Fri, 03 August 2012 18:15 |
Lars Drießnack Messages: 9 Registered: August 2012 |
Junior Member |
|
|
Hi,
thank you for your answer.
What do you mean with fields and properties? All annotations are directly on the private variable of the class or on the class itself (like @Entity), nothing on getters or somewhere else.
This is the log when loading a team which should have 2 players:
[EL Finer]: client released
[EL Finer]: client acquired: 1688731466
[EL Finer]: acquire unit of work: 1365870310
[EL Finest]: Execute query ReadObjectQuery(name="readObject" referenceClass=Team sql="SELECT ID, COUNTRY, INSERTEDAT, INSERTEDBY, NAME, TOURNAMENT_ID FROM MYT_Team WHERE (ID = ?)")
[EL Finest]: Register the existing object de.ld.mytournament.domain.entity.team.Team@4f77d12e
[EL Finest]: Register the existing object de.ld.mytournament.domain.entity.tournament.Tournament@55c2a210
[EL Finest]: Register the existing object de.ld.mytournament.domain.entity.tournament.TournamentProperties@cd76ae54
As you can see the framework shows that team, tournament and tournamentproperties entities are loaded but no player entities.
I tried to analise the log, the only thing i found was this error, but this should be no problem (msg is written for lots of tables while creating the database):
[EL Finest]: Connection(30136561)--Connection acquired from connection pool [default].
[EL Fine]: Connection(30136561)--ALTER TABLE MYT_Player DROP CONSTRAINT FK_MYT_Player_TEAM_ID
[EL Fine]: SELECT 1 FROM DUAL
[EL Finest]: Connection(30136561)--Connection released to connection pool [default].
[EL Warning]: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-00942: Tabelle oder View nicht vorhanden
Error Code: 942
Call: ALTER TABLE MYT_Player DROP CONSTRAINT FK_MYT_Player_TEAM_ID
Query: DataModifyQuery(sql="ALTER TABLE MYT_Player DROP CONSTRAINT FK_MYT_Player_TEAM_ID")
regards
|
|
|
Re: @OneToMany Annotation problem [message #900777 is a reply to message #900064] |
Wed, 08 August 2012 13:01 |
|
When you create your objects you must set both sides of the relationship. You are most likely only setting the ManyToOne and not adding to the OneToMany, you have to do both, otherwise your objects are out of synch. Because EclipseLink maintains a shared cache, you get back what you inserted, so get the same out of synch data. You should fix your code, but you could also disable caching, or refresh the object.
James : Wiki : Book : Blog : Twitter
|
|
|
|
Powered by
FUDForum. Page generated in 0.03319 seconds