Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Peter Sankauskas
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Enhancer (ARCHIVED)

PK generation fails when enhancing with multiple primary keys for JDO

Created: 11/Feb/10 08:19 PM   Updated: 04/Mar/10 02:41 PM   Resolved: 12/Feb/10 12:22 PM
Component/s: ASM Enhancer
Affects Version/s: 2.0.0.m4
Fix Version/s: 2.0.1

Environment: Ubuntu 9.04 64bit, Java 6, Ant 1.7.1, MySQL 5.1, JDO 2.3

Datastore: MySQL

 Description  « Hide
I would like to have a JDO class that has multiple primary keys, but unfortunately, then the class cannot be enhanced successfully. The class is:

public class SomeClass {
    @Column(allowsNull = "False", sqlType = "TINYINT")
    protected int field1;

    @Column(allowsNull = "False")
    protected Date field2;

    @Column(allowsNull = "False")
    protected long field3;

    @Column(allowsNull = "False")
    protected long field4;

    @Column(allowsNull = "False")
    protected long field5;

    @Column(allowsNull = "False")
    protected long field6;

    @Column(allowsNull = "False")
    protected long field7;

    @Column(allowsNull = "False")
    protected long field8;

    @Column(allowsNull = "False")
    protected long field9;

Which for MySQL should generate the following schema:

  , field3 BIGINT NOT NULL
  , field4 BIGINT NOT NULL
  , field5 BIGINT NOT NULL
  , field6 BIGINT NOT NULL
  , field7 BIGINT NOT NULL
  , field8 BIGINT NOT NULL
  , field9 BIGINT NOT NULL
  , PRIMARY KEY (field1, field2, field3, field4)

That schema results in data being stored on disk in sorted order of the primary key fields - exactly what I want.

But when I try to enhance this class, the following error occurs:

17:51:23,356 (main) ERROR [DataNucleus.Enhancer] - Error thrown enhancing with ASMClassEnhancer
java.lang.ArrayIndexOutOfBoundsException: 5
at org.objectweb.asm.MethodWriter.visitFrame(Unknown Source)
at org.datanucleus.enhancer.asm.primarykey.PrimaryKeyGenerator.addStringConstructor(
at org.datanucleus.enhancer.asm.primarykey.PrimaryKeyGenerator.generate(
at org.datanucleus.enhancer.asm.ASMClassEnhancer.enhance(
at org.datanucleus.enhancer.DataNucleusEnhancer.enhanceClass(
at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(
at org.datanucleus.enhancer.DataNucleusEnhancer.main(
17:51:23,356 (main) ERROR [DataNucleus.Enhancer] - DataNucleus Enhancer completed with an error. Please review the enhancer log for full details. Some classes may have been enhanced but some caused errors
Failure during enhancement of classes - see the log for details
org.datanucleus.exceptions.NucleusException: Failure during enhancement of classes - see the log for details
at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(
at org.datanucleus.enhancer.DataNucleusEnhancer.main(

Any chance of getting this fixed?

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 12/Feb/10 12:22 PM
Obviously you could easily provide a PK class as per what has been needed since day one on this project. Alternatively use SVN trunk which likely works on your case; left as an exercise since no testcase was attached