java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

Gabriel Rossetti-6
Hi All,
 
I getting this :
 
java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2
 
When I use HSQLDB but it works fine with an Oracle DB. I am using HSQLDB 2.2.8 with Oracle Syntax.
 
Seq is defined like so:
 
  @Id
  @Column(name="ID", nullable=false)
  @GeneratedValue(strategy=GenerationType.AUTO, generator="EVENT_SEQ")
  @SequenceGenerator(name=”EVENT_SEQ",
                     sequenceName="EVENT_SEQ",
                     allocationSize=1)
  public Integer seq = 0
 
In the table it’s defined like this:
 
ID                INTEGER NOT NULL,
 
And the sequence is defined like this :
 
 
CREATE SEQUENCE EVENT_SEQ AS INTEGER START WITH 1 INCREMENT BY 1 MINVALUE 1 NO CYCLE NO MAXVALUE;
 
Does anyone know why it is doing this?
 
Thanks,
Gabriel
 

  ________________________________  

This email and any attachments are confidential and access to this email or attachment by anyone other than the addressee is unauthorised. If you are not the intended recipient please notify the sender and delete the email including any attachments. You must not disclose or distribute any of the contents to any other person. Personal views or opinions are solely those of the author and not of Trafigura. Trafigura does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. By communicating with anyone at Trafigura by email, you consent to the monitoring or interception of such email by Trafigura in accordance with its internal policies. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted.

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

Fred Toussi-2
If you are using the Hibernate HSQLDialect please try to get a more extensive error message. Otherwise it is difficult to comment.
 
Fred
 
 
On Thu, Mar 8, 2012, at 16:43, Gabriel Rossetti wrote:
Hi All,
 
I getting this :
 
java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2
 
When I use HSQLDB but it works fine with an Oracle DB. I am using HSQLDB 2.2.8 with Oracle Syntax.
 
Seq is defined like so:
 
  @Id
  @Column(name="ID", nullable=false)
  @GeneratedValue(strategy=GenerationType.AUTO, generator="EVENT_SEQ")
  @SequenceGenerator(name=”EVENT_SEQ",
                     sequenceName="EVENT_SEQ",
                     allocationSize=1)
  public Integer seq = 0
 
In the table it’s defined like this:
 
ID                INTEGER NOT NULL,
 
And the sequence is defined like this :
 
 
CREATE SEQUENCE EVENT_SEQ AS INTEGER START WITH 1 INCREMENT BY 1 MINVALUE 1 NO CYCLE NO MAXVALUE;
 
Does anyone know why it is doing this?
 
Thanks,
Gabriel
 
 
  ________________________________  

This email and any attachments are confidential and access to this email or attachment by anyone other than the addressee is unauthorised. If you are not the intended recipient please notify the sender and delete the email including any attachments. You must not disclose or distribute any of the contents to any other person. Personal views or opinions are solely those of the author and not of Trafigura. Trafigura does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. By communicating with anyone at Trafigura by email, you consent to the monitoring or interception of such email by Trafigura in accordance with its internal policies. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted.
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user

 

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

Gabriel Rossetti-6

Hi Fred,

 

I attached the whole output.

 

I debugged all the way down to the error, it seems that the string “POST_INSERT_INDICATOR” is being set instead of an Integer.

 

I just came across this : http://stackoverflow.com/questions/6436589/getting-error-while-setting-generated-id-in-hibernate

 

Which has this comment:

 

Some generators can't generate the identifier before the actual insert, therefore they return a special marker object from the generate() method. This object indicates that Hibernate should obtain identifier in different way, using PostInsertIdentifierGenerator.getInsertGeneratedIdentifierDelegate()

 

This looks like what is happening to me. Is this by design? I’m not sure how to proceed.

 

Gabriel

 

From: Fred Toussi [mailto:[hidden email]]
Sent: 08 March 2012 18:08
To: User discussions about HyperSQL Database Engine.
Subject: Re: [Hsqldb-user] java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

 

If you are using the Hibernate HSQLDialect please try to get a more extensive error message. Otherwise it is difficult to comment.

 

Fred

 

 

On Thu, Mar 8, 2012, at 16:43, Gabriel Rossetti wrote:

Hi All,

 

I getting this :

 

java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2

 

When I use HSQLDB but it works fine with an Oracle DB. I am using HSQLDB 2.2.8 with Oracle Syntax.

 

Seq is defined like so:

 

  @Id

  @Column(name="ID", nullable=false)

  @GeneratedValue(strategy=GenerationType.AUTO, generator="EVENT_SEQ")

  @SequenceGenerator(name=”EVENT_SEQ",

                     sequenceName="EVENT_SEQ",

                     allocationSize=1)

  public Integer seq = 0

 

In the table it’s defined like this:

 

ID                INTEGER NOT NULL,

 

And the sequence is defined like this :

 

 

CREATE SEQUENCE EVENT_SEQ AS INTEGER START WITH 1 INCREMENT BY 1 MINVALUE 1 NO CYCLE NO MAXVALUE;

 

Does anyone know why it is doing this?

 

Thanks,

Gabriel

 

 

  ________________________________  


This email and any attachments are confidential and access to this email or attachment by anyone other than the addressee is unauthorised. If you are not the intended recipient please notify the sender and delete the email including any attachments. You must not disclose or distribute any of the contents to any other person. Personal views or opinions are solely those of the author and not of Trafigura. Trafigura does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. By communicating with anyone at Trafigura by email, you consent to the monitoring or interception of such email by Trafigura in accordance with its internal policies. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted.

 
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
 
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
 

 


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user

hsqldb_error.txt (14K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

Gabriel Rossetti-6

I have found a workaround, instead of using the JPA @SequenceGenerator annotation use the Hibernate @GenericGenerator. So my code now becomes:

 

  @Id

  @Column(name="ID", nullable=false)

  @GeneratedValue(strategy=GenerationType.AUTO, generator="EVENT_SEQ")

  @GenericGenerator(name=" EVENT_SEQ",

                    strategy="sequence",

                    parameters=Array(

                      new Parameter(name="sequence",

                                    value=" EVENT _SEQ")))

  public int seq = 0

 

instead of:

 

  @Id

  @Column(name="ID", nullable=false)

  @GeneratedValue(strategy=GenerationType.AUTO, generator="EVENT_SEQ")

  @SequenceGenerator(name=”EVENT_SEQ",

                     sequenceName="EVENT_SEQ",

                     allocationSize=1)

  public int seq = 0

 

Fred, do you know why one works and the other doesn’t? Both work with the Oracle driver.

 

Gabriel

 

From: Gabriel Rossetti
Sent: 08 March 2012 18:23
To: User discussions about HyperSQL Database Engine.
Cc: Gabriel Rossetti
Subject: RE: [Hsqldb-user] java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

 

Hi Fred,

 

I attached the whole output.

 

I debugged all the way down to the error, it seems that the string “POST_INSERT_INDICATOR” is being set instead of an Integer.

 

I just came across this : http://stackoverflow.com/questions/6436589/getting-error-while-setting-generated-id-in-hibernate

 

Which has this comment:

 

Some generators can't generate the identifier before the actual insert, therefore they return a special marker object from the generate() method. This object indicates that Hibernate should obtain identifier in different way, using PostInsertIdentifierGenerator.getInsertGeneratedIdentifierDelegate()

 

This looks like what is happening to me. Is this by design? I’m not sure how to proceed.

 

Gabriel

 

From: Fred Toussi [mailto:[hidden email]]
Sent: 08 March 2012 18:08
To: User discussions about HyperSQL Database Engine.
Subject: Re: [Hsqldb-user] java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

 

If you are using the Hibernate HSQLDialect please try to get a more extensive error message. Otherwise it is difficult to comment.

 

Fred

 

 

On Thu, Mar 8, 2012, at 16:43, Gabriel Rossetti wrote:

Hi All,

 

I getting this :

 

java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2

 

When I use HSQLDB but it works fine with an Oracle DB. I am using HSQLDB 2.2.8 with Oracle Syntax.

 

Seq is defined like so:

 

  @Id

  @Column(name="ID", nullable=false)

  @GeneratedValue(strategy=GenerationType.AUTO, generator="EVENT_SEQ")

  @SequenceGenerator(name=”EVENT_SEQ",

                     sequenceName="EVENT_SEQ",

                     allocationSize=1)

  public Integer seq = 0

 

In the table it’s defined like this:

 

ID                INTEGER NOT NULL,

 

And the sequence is defined like this :

 

 

CREATE SEQUENCE EVENT_SEQ AS INTEGER START WITH 1 INCREMENT BY 1 MINVALUE 1 NO CYCLE NO MAXVALUE;

 

Does anyone know why it is doing this?

 

Thanks,

Gabriel

 

 

  ________________________________  


This email and any attachments are confidential and access to this email or attachment by anyone other than the addressee is unauthorised. If you are not the intended recipient please notify the sender and delete the email including any attachments. You must not disclose or distribute any of the contents to any other person. Personal views or opinions are solely those of the author and not of Trafigura. Trafigura does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. By communicating with anyone at Trafigura by email, you consent to the monitoring or interception of such email by Trafigura in accordance with its internal policies. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted.

 
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
 
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
 

 


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

Fred Toussi-2
This may be accounted by differences in dialects, which indicate different strategies for generated values.
 
If you can reduce this to a simple test case, I should be able to investigate further.
 
Fred
 
On Fri, Mar 9, 2012, at 12:49, Gabriel Rossetti wrote:

I have found a workaround, instead of using the JPA @SequenceGenerator annotation use the Hibernate @GenericGenerator. So my code now becomes:

 

  @Id

  @Column(name="ID", nullable=false)

  @GeneratedValue(strategy=GenerationType.AUTO, generator="EVENT_SEQ")

  @GenericGenerator(name=" EVENT_SEQ",

                    strategy="sequence",

                    parameters=Array(

                      new Parameter(name="sequence",

                                    value=" EVENT _SEQ")))

  public int seq = 0

 

instead of:

 

  @Id

  @Column(name="ID", nullable=false)

  @GeneratedValue(strategy=GenerationType.AUTO, generator="EVENT_SEQ")

  @SequenceGenerator(name=”EVENT_SEQ",

                     sequenceName="EVENT_SEQ",

                     allocationSize=1)

  public int seq = 0

 

Fred, do you know why one works and the other doesn’t? Both work with the Oracle driver.

 

Gabriel

 

From: Gabriel Rossetti
Sent: 08 March 2012 18:23
To: User discussions about HyperSQL Database Engine.
Cc: Gabriel Rossetti
Subject: RE: [Hsqldb-user] java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

 

Hi Fred,

 

I attached the whole output.

 

I debugged all the way down to the error, it seems that the string “POST_INSERT_INDICATOR” is being set instead of an Integer.

 

I just came across this : http://stackoverflow.com/questions/6436589/getting-error-while-setting-generated-id-in-hibernate

 

Which has this comment:

 

Some generators can't generate the identifier before the actual insert, therefore they return a special marker object from the generate() method. This object indicates that Hibernate should obtain identifier in different way, using PostInsertIdentifierGenerator.getInsertGeneratedIdentifierDelegate()

 

This looks like what is happening to me. Is this by design? I’m not sure how to proceed.

 

Gabriel

 

From: Fred Toussi [mailto:[hidden email]]
Sent: 08 March 2012 18:08
To: User discussions about HyperSQL Database Engine.
Subject: Re: [Hsqldb-user] java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2 anyone?

 

If you are using the Hibernate HSQLDialect please try to get a more extensive error message. Otherwise it is difficult to comment.

 

Fred

 

 

On Thu, Mar 8, 2012, at 16:43, Gabriel Rossetti wrote:

Hi All,

 

I getting this :

 

java.lang.IllegalArgumentException: Can not set int field com.toto.persistence.entities.TestEntity.seq to org.hibernate.id.IdentifierGeneratorHelper$2

 

When I use HSQLDB but it works fine with an Oracle DB. I am using HSQLDB 2.2.8 with Oracle Syntax.

 

Seq is defined like so:

 

  @Id

  @Column(name="ID", nullable=false)

  @GeneratedValue(strategy=GenerationType.AUTO, generator="EVENT_SEQ")

  @SequenceGenerator(name=”EVENT_SEQ",

                     sequenceName="EVENT_SEQ",

                     allocationSize=1)

  public Integer seq = 0

 

In the table it’s defined like this:

 

ID                INTEGER NOT NULL,

 

And the sequence is defined like this :

 

 

CREATE SEQUENCE EVENT_SEQ AS INTEGER START WITH 1 INCREMENT BY 1 MINVALUE 1 NO CYCLE NO MAXVALUE;

 

Does anyone know why it is doing this?

 

Thanks,

Gabriel

 

 

  ________________________________  


This email and any attachments are confidential and access to this email or attachment by anyone other than the addressee is unauthorised. If you are not the intended recipient please notify the sender and delete the email including any attachments. You must not disclose or distribute any of the contents to any other person. Personal views or opinions are solely those of the author and not of Trafigura. Trafigura does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. By communicating with anyone at Trafigura by email, you consent to the monitoring or interception of such email by Trafigura in accordance with its internal policies. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted.

 
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
 
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
 

 

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user

 

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user