openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r604621 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ openjpa-kernel/src/main/java/org/apache/openjpa/meta/ openjpa-kernel/src/main/java/org/apache/openjpa/util/ openjpa-persistence-jdbc/src/test/java/org/apa...
Date Sun, 16 Dec 2007 12:30:17 GMT
Author: pcl
Date: Sun Dec 16 04:30:15 2007
New Revision: 604621

URL: http://svn.apache.org/viewvc?rev=604621&view=rev
Log:
OPENJPA-331. Checking in on behalf of Miroslav Nachev. Includes minor whitespace reformatting
and @since tags for new source classes.

Added:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigDecimalIdEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigIntegerIdEntity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigIntegerId.java
Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAFacadeHelper.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java?rev=604621&r1=604620&r2=604621&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
Sun Dec 16 04:30:15 2007
@@ -47,7 +47,6 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.conf.OpenJPAConfigurationImpl;
-import org.apache.openjpa.lib.conf.Configuration;
 import org.apache.openjpa.lib.conf.Configurations;
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.meta.ClassArgParser;
@@ -65,6 +64,8 @@
 import org.apache.openjpa.meta.ValueStrategies;
 import org.apache.openjpa.util.GeneralException;
 import org.apache.openjpa.util.InternalException;
+import org.apache.openjpa.util.BigDecimalId;
+import org.apache.openjpa.util.BigIntegerId;
 import org.apache.openjpa.util.ByteId;
 import org.apache.openjpa.util.CharId;
 import org.apache.openjpa.util.DateId;
@@ -2100,6 +2101,18 @@
                     code.checkcast().setType(StringId.class);
                     code.invokevirtual().setMethod(StringId.class, "getId",
                         String.class, null);
+                    break;
+                case JavaTypes.BIGDECIMAL:
+                    code.aload().setLocal(oid);
+                    code.checkcast().setType(BigDecimalId.class);
+                    code.invokevirtual().setMethod(BigDecimalId.class, "getId",
+                        BigDecimalId.class, null);
+                    break;
+                case JavaTypes.BIGINTEGER:
+                    code.aload().setLocal(oid);
+                    code.checkcast().setType(BigIntegerId.class);
+                    code.invokevirtual().setMethod(BigIntegerId.class, "getId",
+                        BigIntegerId.class, null);
                     break;
                 default:
                     code.aload().setLocal(oid);

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java?rev=604621&r1=604620&r2=604621&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
Sun Dec 16 04:30:15 2007
@@ -46,6 +46,8 @@
 import org.apache.openjpa.lib.util.J2DoPrivHelper;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.lib.xml.Commentable;
+import org.apache.openjpa.util.BigDecimalId;
+import org.apache.openjpa.util.BigIntegerId;
 import org.apache.openjpa.util.ByteId;
 import org.apache.openjpa.util.CharId;
 import org.apache.openjpa.util.DateId;
@@ -481,6 +483,12 @@
             case JavaTypes.OID:
             case JavaTypes.OBJECT:
                 _objectId = ObjectId.class;
+                break;
+            case JavaTypes.BIGDECIMAL:
+                _objectId = BigDecimalId.class;
+                break;
+            case JavaTypes.BIGINTEGER:
+                _objectId = BigIntegerId.class;
                 break;
         }
         return _objectId;

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java?rev=604621&r1=604620&r2=604621&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
Sun Dec 16 04:30:15 2007
@@ -20,6 +20,8 @@
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.util.Date;
@@ -170,6 +172,14 @@
                 case JavaTypes.OID:
                 case JavaTypes.OBJECT:
                     return new ObjectId(meta.getDescribedType(), val);
+                case JavaTypes.BIGDECIMAL:
+                    if (!convert && !(val instanceof BigDecimal))
+                        throw new ClassCastException("!(x instanceof BigDecimal)");
+                    return new BigDecimalId(meta.getDescribedType(), (BigDecimal)val);
+                case JavaTypes.BIGINTEGER:
+                    if (!convert && !(val instanceof BigInteger))
+                        throw new ClassCastException("!(x instanceof BigInteger)");
+                    return new BigIntegerId(meta.getDescribedType(), (BigInteger)val);
                 default:
                     throw new InternalException();
             }
@@ -274,6 +284,12 @@
                         koid.hasSubclasses());
                 case JavaTypes.DATE:
                     return new DateId(cls, ((DateId) oid).getId(),
+                        koid.hasSubclasses());
+                case JavaTypes.BIGDECIMAL:
+                    return new BigDecimalId(cls, ((BigDecimalId) oid).getId(),
+                        koid.hasSubclasses());
+                case JavaTypes.BIGINTEGER:
+                    return new BigIntegerId(cls, ((BigIntegerId) oid).getId(),
                         koid.hasSubclasses());
                 default:
                     throw new InternalException();

Added: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java?rev=604621&view=auto
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java (added)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java Sun
Dec 16 04:30:15 2007
@@ -0,0 +1,72 @@
+/*
+ *  Copyright 2007 Miroslav Nachev.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+package org.apache.openjpa.util;
+
+import java.math.BigDecimal;
+
+/**
+ * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
+ * @since 1.1.0
+ */
+public class BigDecimalId
+    extends OpenJPAId {
+
+    private final BigDecimal key;
+
+    public BigDecimalId(Class cls, String key) {
+        this(cls, (key == null) ? null : new BigDecimal(key));
+    }
+
+    public BigDecimalId(Class cls, BigDecimal key) {
+        super(cls);
+        this.key = key;
+    }
+
+    public BigDecimalId(Class cls, BigDecimal key, boolean subs) {
+        super(cls, subs);
+        this.key = key;
+    }
+
+    public BigDecimal getId() {
+        return key;
+    }
+
+    public Object getIdObject() {
+        return key;
+    }
+
+    public String toString() {
+        if (key == null)
+            return "NULL";
+
+        return key.toString();
+    }
+
+    protected int idHash() {
+        if (key != null)
+            return key.hashCode();
+
+        return 0;
+    }
+
+    protected boolean idEquals(OpenJPAId other) {
+        if(key == null)
+            return false;
+
+        return key.equals(other);
+    }
+}

Added: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java?rev=604621&view=auto
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java (added)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java Sun
Dec 16 04:30:15 2007
@@ -0,0 +1,73 @@
+/*
+ *  Copyright 2007 Miroslav Nachev.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+package org.apache.openjpa.util;
+
+import java.math.BigInteger;
+
+/**
+ * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
+ * @since 1.1.0
+ */
+public class BigIntegerId
+    extends OpenJPAId {
+
+    private final BigInteger key;
+
+    public BigIntegerId(Class cls, String key) {
+        this(cls, (key == null) ? null : new BigInteger(key));
+    }
+
+    public BigIntegerId(Class cls, BigInteger key) {
+        super(cls);
+        this.key = key;
+    }
+
+    public BigIntegerId(Class cls, BigInteger key, boolean subs) {
+        super(cls, subs);
+        this.key = key;
+    }
+
+    public BigInteger getId() {
+        return key;
+    }
+
+    public Object getIdObject() {
+        return key;
+    }
+
+    public String toString() {
+        if (key == null)
+            return "NULL";
+
+        return key.toString();
+    }
+
+    protected int idHash() {
+        if (key != null)
+            return key.hashCode();
+
+        return 0;
+    }
+
+    protected boolean idEquals(OpenJPAId other) {
+        if (key == null)
+            return false;
+
+        return key.equals(other);
+    }
+
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigDecimalIdEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigDecimalIdEntity.java?rev=604621&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigDecimalIdEntity.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigDecimalIdEntity.java
Sun Dec 16 04:30:15 2007
@@ -0,0 +1,48 @@
+/*
+ *  Copyright 2007 Miroslav Nachev.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+package org.apache.openjpa.persistence.identity;
+
+import java.math.BigDecimal;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
+ */
+@Entity
+public class SQLBigDecimalIdEntity {
+
+    @Id
+    private BigDecimal id;
+    private int data;
+
+    public BigDecimal getId() {
+        return id;
+    }
+
+    public void setId(BigDecimal id) {
+        this.id = id;
+    }
+
+    public int getData() {
+        return data;
+    }
+
+    public void setData(int data) {
+        this.data = data;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigIntegerIdEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigIntegerIdEntity.java?rev=604621&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigIntegerIdEntity.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/SQLBigIntegerIdEntity.java
Sun Dec 16 04:30:15 2007
@@ -0,0 +1,48 @@
+/*
+ *  Copyright 2007 Miroslav Nachev.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+package org.apache.openjpa.persistence.identity;
+
+import java.math.BigInteger;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
+ */
+@Entity
+public class SQLBigIntegerIdEntity {
+
+    @Id
+    private BigInteger id;
+    private int data;
+
+    public BigInteger getId() {
+        return id;
+    }
+
+    public void setId(BigInteger id) {
+        this.id = id;
+    }
+
+    public int getData() {
+        return data;
+    }
+
+    public void setData(int data) {
+        this.data = data;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java?rev=604621&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java
Sun Dec 16 04:30:15 2007
@@ -0,0 +1,59 @@
+/*
+ *  Copyright 2007 Miroslav Nachev.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+package org.apache.openjpa.persistence.identity;
+
+import java.math.BigDecimal;
+import javax.persistence.EntityManager;
+
+import junit.textui.TestRunner;
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+
+/**
+ * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
+ */
+public class TestSQLBigDecimalId
+    extends SingleEMFTestCase {
+
+    public void setUp() {
+        setUp(SQLBigDecimalIdEntity.class, CLEAR_TABLES);
+    }
+
+    public void testPersist() {
+        long time = ((long) (System.currentTimeMillis() / 1000)) * 1000;
+        BigDecimal decimal = new BigDecimal(time);
+
+        SQLBigDecimalIdEntity e = new SQLBigDecimalIdEntity();
+        e.setId(decimal);
+        e.setData(1);
+
+        EntityManager em = emf.createEntityManager();
+        em.getTransaction().begin();
+        em.persist(e);
+        em.getTransaction().commit();
+        assertEquals(time, e.getId().longValue());
+        em.close();
+
+        em = emf.createEntityManager();
+        e = em.find(SQLBigDecimalIdEntity.class, decimal);
+        assertEquals(1, e.getData());
+        em.close();
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(SQLBigDecimalIdEntity.class);
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigIntegerId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigIntegerId.java?rev=604621&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigIntegerId.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigIntegerId.java
Sun Dec 16 04:30:15 2007
@@ -0,0 +1,60 @@
+/*
+ *  Copyright 2007 Miroslav Nachev.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+package org.apache.openjpa.persistence.identity;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import javax.persistence.EntityManager;
+
+import junit.textui.TestRunner;
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+
+/**
+ * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
+ */
+public class TestSQLBigIntegerId
+    extends SingleEMFTestCase {
+
+    public void setUp() {
+        setUp(SQLBigIntegerIdEntity.class, CLEAR_TABLES);
+    }
+
+    public void testPersist() {
+        long time = ((long) (System.currentTimeMillis() / 1000)) * 1000;
+        BigInteger integer = new BigDecimal(time).toBigInteger();
+
+        SQLBigIntegerIdEntity e = new SQLBigIntegerIdEntity();
+        e.setId(integer);
+        e.setData(1);
+
+        EntityManager em = emf.createEntityManager();
+        em.getTransaction().begin();
+        em.persist(e);
+        em.getTransaction().commit();
+        assertEquals(time, e.getId().longValue());
+        em.close();
+
+        em = emf.createEntityManager();
+        e = em.find(SQLBigIntegerIdEntity.class, integer);
+        assertEquals(1, e.getData());
+        em.close();
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(SQLBigIntegerIdEntity.class);
+    }
+}

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAFacadeHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAFacadeHelper.java?rev=604621&r1=604620&r2=604621&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAFacadeHelper.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAFacadeHelper.java
Sun Dec 16 04:30:15 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.openjpa.persistence;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -27,6 +29,8 @@
 import org.apache.openjpa.kernel.Broker;
 import org.apache.openjpa.kernel.BrokerFactory;
 import org.apache.openjpa.meta.ClassMetaData;
+import org.apache.openjpa.util.BigDecimalId;
+import org.apache.openjpa.util.BigIntegerId;
 import org.apache.openjpa.util.ByteId;
 import org.apache.openjpa.util.CharId;
 import org.apache.openjpa.util.DoubleId;
@@ -231,6 +235,10 @@
             return new ShortId(cls, (Short) oid);
         if (oid instanceof String)
             return new StringId(cls, (String) oid);
+        if (oid instanceof BigDecimal)
+            return new BigDecimalId(cls, (BigDecimal) oid);
+        if (oid instanceof BigInteger)
+            return new BigIntegerId(cls, (BigInteger) oid);
         return new ObjectId(cls, oid);
     }
 
@@ -301,7 +309,11 @@
         if (oidClass == ShortId.class)
             return Short.class;
         if (oidClass == StringId.class)
-			return String.class;
-		return oidClass;
+            return String.class;
+        if (oidClass == BigDecimalId.class)
+            return BigDecimal.class;
+        if (oidClass == BigIntegerId.class)
+            return BigInteger.class;
+        return oidClass;
 	}
 }



Mime
View raw message