openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Benson <jpbenson4...@winona.edu>
Subject A few questions regarding Externalization.
Date Mon, 13 Aug 2007 16:20:48 GMT

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.


Mime
View raw message