[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Table generation using wrong generator?

I am using JPA's table generation facilities (using the EclipseLink that ships with GlassFish 3.1.2.2).

I am getting a duplicate key exception that suggests that perhaps EclipseLink is reading the wrong generator.

That is, I have one entity that defines a generator like this:

@TableGenerator(
 name = "PartyEntityIDGenerator",
 table = "JPAGenerators",
 pkColumnName = "generatorName",
 pkColumnValue = "PartyEntityIDGenerator",
 valueColumnName = "generatorValue",
 allocationSize = 50
)

And another that defines a generator like this:

@TableGenerator(
 name = "AnswerSelectionEntityIDGenerator",
 table = "JPAGenerators",
 pkColumnName = "generatorName",
 pkColumnValue = "AnswerSelectionEntityIDGenerator",
 valueColumnName = "generatorValue",
 allocationSize = 50
)

And I have a table named JPAGenerators that is set up to match.

The generator value in the actual table in the first case is greater than 30000 (don't remember the actual value), while the generator value in the actual table in the second case is around 100.

When I go to insert a new AnswerSelectionEntity, I get a duplicate key exception that indicates that a key with the value "30108" already exists. ÂBut this number smells suspiciously like a PartyEntity id, not an AnswerSelectionEntity id.

Is this a known issue? ÂI understand the next thing that will happen on the list is that someone will say "please submit a test case" which I will attempt to do (probably without success given my prior track record), but before I spend time doing this I wanted to see if this issue had ever cropped up before, or if someone who is familiar with that area of the code could give it a once-over.

Best,
Laird

--
http://about.me/lairdnelson