Issue Details (XML | Word | Printable)

Key: OPENJPA-214
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Kevin Sutter
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenJPA

Need to support floating point primary keys

Created: 11/Apr/07 03:42 PM   Updated: 15/Apr/07 02:35 AM
Return to search
Component/s: jdbc
Affects Version/s: 0.9.7
Fix Version/s: 0.9.7

Time Tracking:
Not Specified

Resolution Date: 11/Apr/07 08:26 PM


 Description  « Hide
Dain first reported this problem on the dev mailing list:

http://www.nabble.com/Float-primary-key--tf3557137.html

>My response:
>Okay, I looked at the spec a bit closer and it looks like we need to allow for floats as primary keys:

>"The primary key (or field or property of a composite primary key) should be one of the following types:
>any Java primitive type; any primitive wrapper type; java.lang.String; java.util.Date;
>java.sql.Date. In general, however, approximate numeric types (e.g., floating point types) should
>never be used in primary keys."

>Although the spec clearly recommends against the use of floating points, floats are a primitive type (or the Float wrapper) and need to be allowed. With no >special "AllowStupidApproximatePrimaryKeys" flag. :-)

>Am I trying to read too much into the spec or Dain's request? This seems to be something that we need to support.

>>Abe's response:
>>Given the spec section you quoted, you're definitely right. It's something we need to support.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Abe White made changes - 11/Apr/07 07:52 PM
Field Original Value New Value
Assignee Abe White [ awhite ]
Repository Revision Date User Message
ASF #527648 Wed Apr 11 20:25:11 UTC 2007 awhite OPENJPA-214 : Support float and double fields as single-field identity primary
keys.
Files Changed
MODIFY /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
MODIFY /incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAPersistence.java
ADD /incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/FloatIdEntity.java
ADD /incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestFloatingPointIds.java
ADD /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/FloatId.java
MODIFY /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
ADD /incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/DoubleObjIdEntity.java
ADD /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/DoubleId.java
MODIFY /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java

Abe White added a comment - 11/Apr/07 08:26 PM
Support float/Float and double/Double primary key fields in single-field identity handling. Fixed in revision 527648.

Abe White made changes - 11/Apr/07 08:26 PM
Status Open [ 1 ] Resolved [ 5 ]
Assignee Abe White [ awhite ]
Resolution Fixed [ 1 ]
Michael Dick made changes - 15/Apr/07 02:35 AM
Fix Version/s 0.9.8 [ 12312446 ]
Fix Version/s 0.9.7 [ 12312340 ]