openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter" <kwsut...@gmail.com>
Subject Re: Float primary key?
Date Wed, 11 Apr 2007 13:48:05 GMT
Dain,
When you mention the "CMP test suite" are you referring to the CTS TCK?  If
so, how does "CMP" correspond to EJB's and their use of JPA (in the EJB3
sense)?  I understand your request.  I'm just trying to understand whether
this is a "requirement" or just a bad test case in the CTS TCK.  The JPA
spec is pretty clear that approximate types should never be used for primary
keys -- although I suppose you could read it that some providers could allow
this use.  It just wouldn't be portable.

Kevin

On 4/10/07, Dain Sundstrom <dain@iq80.com> wrote:
>
> I know it is a really really really stupid idea to use an approximate
> type at a primary key, but there is a test in the CMP test suite that
> uses a float for a primary key.  When I deploy this bean, I get an
> exception like the following:
>
> Caused by: <0.9.7-incubating-SNAPSHOT fatal user error>
> org.apache.openjpa.persistence.ArgumentException: Type "class
> foo.FloatBeanEJB" declares field "cmpID" as a primary key, but keys
> of type "java.lang.Float" are not supported.
>      at org.apache.openjpa.meta.ClassMetaData.validateAppIdClass
> (ClassMetaData.java:1800)
>      at org.apache.openjpa.meta.ClassMetaData.validateIdentity
> (ClassMetaData.java:1779)
>      at org.apache.openjpa.meta.ClassMetaData.validateMeta
> (ClassMetaData.java:1696)
>      at org.apache.openjpa.meta.ClassMetaData.resolve
> (ClassMetaData.java:1569)
>      at org.apache.openjpa.meta.MetaDataRepository.processBuffer
> (MetaDataRepository.java:656)
>      at org.apache.openjpa.meta.MetaDataRepository.resolveMeta
> (MetaDataRepository.java:556)
>      at org.apache.openjpa.meta.MetaDataRepository.resolve
> (MetaDataRepository.java:481)
>      at org.apache.openjpa.meta.MetaDataRepository.getMetaData
> (MetaDataRepository.java:285)
>      at org.apache.openjpa.meta.MetaDataRepository.resolveMeta
> (MetaDataRepository.java:521)
>      at org.apache.openjpa.meta.MetaDataRepository.resolve
> (MetaDataRepository.java:481)
>      at org.apache.openjpa.meta.MetaDataRepository.getMetaData
> (MetaDataRepository.java:285)
>      at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping
> (MappingRepository.java:276)
>      at org.apache.openjpa.jdbc.meta.MappingTool.getMapping
> (MappingTool.java:667)
>      at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema
> (MappingTool.java:739)
>      at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:
> 637)
>      at
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings
> (JDBCBrokerFactory.java:161)
>      at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl
> (JDBCBrokerFactory.java:127)
>      at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker
> (AbstractBrokerFactory.java:171)
>      at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker
> (DelegatingBrokerFactory.java:139)
>      at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:187)
>      at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
> ger(EntityManagerFactoryImpl.java:52)
>
> Is there any way I can turn off this warning?  Maybe we can add an
> "AllowStupidApproximatePrimaryKeys" flag.
>
> Please :)
>
> -dain
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message