Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @Index with an@ElementCollection(I can not create an Index for an ElementCollection)
@Index with an@ElementCollection [message #1006474] Thu, 31 January 2013 12:45 Go to next message
Guido Häp is currently offline Guido HäpFriend
Messages: 5
Registered: January 2013
Location: Gerolstein
Junior Member
I have the following Element Collection:
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "WH_PickingPos_Semantics",
joinColumns = @JoinColumn(name = "POSITIONID", referencedColumnName = "ID"))
@Column(name = "CLASSNAME")
@Index(name = "WH_Pos_Sem_I1", table = "WH_PickingPos_Semantics",
columnNames = "POSITIONID" )
public Set<String> getSemanticClassNames() {
....

The index is not created.

What can I do?
Re: @Index with an@ElementCollection [message #1007348 is a reply to message #1006474] Tue, 05 February 2013 15:32 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Are you using DDL generation? Enable logging, and see what DDL is generated and if any errors occur.

Also try putting the @Index on the class not the attribute, @Index on the attribute is for basic mappings.


James : Wiki : Book : Blog : Twitter
Re: @Index with an@ElementCollection [message #1007959 is a reply to message #1007348] Fri, 08 February 2013 13:55 Go to previous message
Guido Häp is currently offline Guido HäpFriend
Messages: 5
Registered: January 2013
Location: Gerolstein
Junior Member
Yes, we use DDL generation.
There is no error in the log. The 'Create Index ..' is just missing.

Creating the index in the class gives the 'Create Index ..' just after the 'Create Table ...' for the table of the class.
This causes an SQL-Error because the table 'WH_PickingPos_Semantics' does not exist when the index is to be created.
EclipseLink tryes to create that table later.

EclipseLink should first create all tables for a .java-file and create the indexes afterwards.

With join-tables there is the same problem: Join-tables are created after the the indexes on the two joined classes.

Best would be to create all tables first and create all inexes afterwards.
Previous Topic:JPA Timeouts
Next Topic:Retrieving data from a resultset with two or more same column names.
Goto Forum:
  


Current Time: Tue Nov 25 22:32:55 GMT 2014

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

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