openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@gmail.com>
Subject Re: A few questions regarding Externalization.
Date Mon, 13 Aug 2007 18:57:50 GMT
Hi,

Ideally, a number of the cases that you cited should result in
meaningful errors. I'm not sure how complete the externalization edge
cases are, though.

I think that it is sufficient to just disallow ambiguous
externalization and factory methods. I would guess that different
methods were called at different times either because of small
differences in the way the reflection APIs were used, or indeterminate
ordering in the reflection code somewhere.

It would be useful if you could attach test cases for these various
cases so that we could work on getting better error messages into
place.

Regarding floating-point values: I expect that everything should Just
Work, provided that the values in the field are exactly the same as
the values input in the ExternalValues strings. This certainly could
require some careful setting of the values.

-Patrick

On 8/13/07, Jesse Benson <jpbenson4849@winona.edu> wrote:
>
> Is the use of floats or doubles jeporized by inaccurate internal
> representations?  Is there any other scenario which would not be straight
> forward?
>
> ie:
> @ExternalValues({"1.4=1","1.5=2"})
> @Type(Int.class)
> Double a;
>
>
> What should happen when there is a many to one mapping in @ExternalValues?
>
> ie:
> @ExternalValues({"1.4=1", "1.5=1"})
> @Type(Int.class)
> Double a;
>
>
> What should happen when there is a one to many mapping in @ExternalValues?
>
> ie:
> @ExternalValues({"1.4=1", "1.4=2"})
> @Type(Int.class)
> Double a;
>
>
> What exception should be thrown during a persist when the value of a field
> is set to a bad value?
>
> ie:
> @ExternalValues({"1.4=1", "1.5=2"})
> @Type(Int.class)
> Double a = 9.9;
>
> I am getting the following, which is probably not what end users should see:
>
>
> <0.0.0 fatal store error> org.apache.openjpa.persistence.RollbackException:
> null
>         at
> org.apache.openjpa.persistence.EntityManagerImpl46commit(EntityManagerImpl.java:420)
>         ...
> Caused by: <0.0.0 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: null
>         at
> org.apache.openjpa.kernel.BrokerImpl46beforeCompletion(BrokerImpl.java:1800)
>         at
> org.apache.openjpa.kernel.LocalManagedRuntime46commit(LocalManagedRuntime.java:80)
>         at
> org.apache.openjpa.kernel.BrokerImpl46commit(BrokerImpl.java:1322)
>         at
> org.apache.openjpa.kernel.DelegatingBroker46commit(DelegatingBroker.java:866)
>         at
> org.apache.openjpa.persistence.EntityManagerImpl46commit(EntityManagerImpl.java:409)
>         ... 15 more
> Caused by: java.lang.NullPointerException
>         at
> org.apache.openjpa.kernel.StateManagerImpl46fetchInt(StateManagerImpl.java:2060)
>         at
> org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy46update(PrimitiveFieldStrategy.java:157)
>         at
> org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy46insert(PrimitiveFieldStrategy.java:117)
>         at
> org.apache.openjpa.jdbc.meta.FieldMapping46insert(FieldMapping.java:554)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46insert(AbstractUpdateManager.java:203)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46populateRowManager(AbstractUpdateManager.java:145)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46flush(AbstractUpdateManager.java:85)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46flush(AbstractUpdateManager.java:72)
>         at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager46flush(JDBCStoreManager.java:514)
>         at
> org.apache.openjpa.kernel.DelegatingStoreManager46flush(DelegatingStoreManager.java:130)
>         at org.apache.openjpa.kernel.BrokerImpl46flush(BrokerImpl.java:1976)
>         at
> org.apache.openjpa.kernel.BrokerImpl46flushSafe(BrokerImpl.java:1874)
>         at
> org.apache.openjpa.kernel.BrokerImpl46beforeCompletion(BrokerImpl.java:1792)
>         ... 19 more
> <0.0.0 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: null
>         at
> org.apache.openjpa.kernel.BrokerImpl46beforeCompletion(BrokerImpl.java:1800)
>         at
> org.apache.openjpa.kernel.LocalManagedRuntime46commit(LocalManagedRuntime.java:80)
>         at
> org.apache.openjpa.kernel.BrokerImpl46commit(BrokerImpl.java:1322)
>         at
> org.apache.openjpa.kernel.DelegatingBroker46commit(DelegatingBroker.java:866)
>         at
> org.apache.openjpa.persistence.EntityManagerImpl46commit(EntityManagerImpl.java:409)
>         at
> suite.r70.acommon.transactionservice.RLTransactionService46commitTransaction(RLTransactionService.java:49)
>         ...
> Caused by: java.lang.NullPointerException
>         at
> org.apache.openjpa.kernel.StateManagerImpl46fetchInt(StateManagerImpl.java:2060)
>         at
> org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy46update(PrimitiveFieldStrategy.java:157)
>         at
> org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy46insert(PrimitiveFieldStrategy.java:117)
>         at
> org.apache.openjpa.jdbc.meta.FieldMapping46insert(FieldMapping.java:554)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46insert(AbstractUpdateManager.java:203)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46populateRowManager(AbstractUpdateManager.java:145)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46flush(AbstractUpdateManager.java:85)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46flush(AbstractUpdateManager.java:72)
>         at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager46flush(JDBCStoreManager.java:514)
>         at
> org.apache.openjpa.kernel.DelegatingStoreManager46flush(DelegatingStoreManager.java:130)
>         at org.apache.openjpa.kernel.BrokerImpl46flush(BrokerImpl.java:1976)
>         at
> org.apache.openjpa.kernel.BrokerImpl46flushSafe(BrokerImpl.java:1874)
>         at
> org.apache.openjpa.kernel.BrokerImpl46beforeCompletion(BrokerImpl.java:1792)
>         ... 19 more
>
> Nested Exception:
>
> java.lang.NullPointerException
>         at
> org.apache.openjpa.kernel.StateManagerImpl46fetchInt(StateManagerImpl.java:2060)
>         at
> org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy46update(PrimitiveFieldStrategy.java:157)
>         at
> org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy46insert(PrimitiveFieldStrategy.java:117)
>         at
> org.apache.openjpa.jdbc.meta.FieldMapping46insert(FieldMapping.java:554)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46insert(AbstractUpdateManager.java:203)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46populateRowManager(AbstractUpdateManager.java:145)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46flush(AbstractUpdateManager.java:85)
>         at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager46flush(AbstractUpdateManager.java:72)
>         at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager46flush(JDBCStoreManager.java:514)
>         at
> org.apache.openjpa.kernel.DelegatingStoreManager46flush(DelegatingStoreManager.java:130)
>         at org.apache.openjpa.kernel.BrokerImpl46flush(BrokerImpl.java:1976)
>         at
> org.apache.openjpa.kernel.BrokerImpl46flushSafe(BrokerImpl.java:1874)
>         at
> org.apache.openjpa.kernel.BrokerImpl46beforeCompletion(BrokerImpl.java:1792)
>         at
> org.apache.openjpa.kernel.LocalManagedRuntime46commit(LocalManagedRuntime.java:80)
>         at
> org.apache.openjpa.kernel.BrokerImpl46commit(BrokerImpl.java:1322)
>         at
> org.apache.openjpa.kernel.DelegatingBroker46commit(DelegatingBroker.java:866)
>         at
> org.apache.openjpa.persistence.EntityManagerImpl46commit(EntityManagerImpl.java:409)
>         ...
>
>
> The behavior of a field with an Externalizer and a factory which accepts a
> StoreContext is different than that of one which does not.  I instrumented
> the Constructors, Externalizers, and Factories used by different fields of
> an entity.  The number of times each was called was dramaticly different.
> Is this expected behavior?
>
>
> When there exists a method which accepts a StoreContext, and there exists
> one which does not, providing the Externalizer annotation with this method
> name results in OpenJPA using one method some times, and the other method
> other times.  I have noticed that the placement of the methods within the
> code plays a role in the order of which OpenJPA calls them.
>
> ie:
> @Externalizer("getName")
> ...
>
> public String getName(StoreContext ctx)
> {
>     ...
> }
>
> public String getName()
> {
>     ...
> }
>
> calls the two getName methods in a different order than
>
> @Externalizer("getName")
> ...
>
> public String getName()
> {
>     ...
> }
>
> public String getName(StoreContext ctx)
> {
>     ...
> }
>
>
> Is this as designed?
>
>
> Any clarification in the Externalizer documentation as to the specific
> expected behavior of OpenJPA would be helpful.
>
> --
> View this message in context: http://www.nabble.com/A-few-questions-regarding-Externalization.-tf4262167.html#a12129279
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message