You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Kevin Sutter <kw...@gmail.com> on 2006/09/21 00:37:03 UTC

Issue with GenerationType.IDENTITY?

Hi,
It seems that if I map an ID to an Identity Column, then, OpenJPA
automatically returns a type BigDecimal?  I am not using this type
anywhere.  It does not happen with other Integer or Long mappings, just with
generated strategy.

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name="ORDER_ID")
    public Long getOrderId() {
        return orderId;
    }
    public void setOrderId(Long orderId) {
        this.orderId = orderId;

[9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O
<0|true|0.9.0-incubating-SNAPSHOT>
org.apache.openjpa.persistence.PersistenceException:
java.math.BigDecimalincompatible with
java.lang.Long
[9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1576)
[9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(
StateManagerImpl.java:475)
[9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
org.apache.openjpa.kernel.StateManagerImpl.assignField(StateManagerImpl.java
:554)
[9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(
StateManagerImpl.java:1325)
[9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
org.apache.openjpa.kernel.StateManagerImpl.accessingField(
StateManagerImpl.java:1308)

Before I dig further, I thought I would check with the group first.  Thanks.

Kevin

Re: Issue with GenerationType.IDENTITY?

Posted by Kevin Sutter <kw...@gmail.com>.
FYI, it seems that the changes that Abe did for OPENJPA-13 (via 453016)
resolved this problem.  The various class types (Long, Integer, etc) are now
processed correctly.  Thanks, Abe, for the solution.

Kevin


On 9/20/06, Kevin Sutter <kw...@gmail.com> wrote:
>
> Hi,
> It seems that if I map an ID to an Identity Column, then, OpenJPA
> automatically returns a type BigDecimal?  I am not using this type
> anywhere.  It does not happen with other Integer or Long mappings, just with
> generated strategy.
>
>     @Id
>     @GeneratedValue(strategy=GenerationType.IDENTITY)
>     @Column(name="ORDER_ID")
>     public Long getOrderId() {
>         return orderId;
>     }
>     public void setOrderId(Long orderId) {
>         this.orderId = orderId;
>
> [9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O
> <0|true|0.9.0-incubating-SNAPSHOT>
> org.apache.openjpa.persistence.PersistenceException: java.math.BigDecimalincompatible with
> java.lang.Long
> [9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
> org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1576)
> [9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
> org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(
> StateManagerImpl.java:475)
> [9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
> org.apache.openjpa.kernel.StateManagerImpl.assignField(
> StateManagerImpl.java:554)
> [9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
> org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(
> StateManagerImpl.java:1325)
> [9/19/06 17:44:23:750 EDT] 0000002d SystemOut     O     at
> org.apache.openjpa.kernel.StateManagerImpl.accessingField(
> StateManagerImpl.java:1308)
>
> Before I dig further, I thought I would check with the group first.
> Thanks.
>
> Kevin
>