I'm using 2.1.0 and enhancing with the ant PCEnhancerTask, it's running in 
Glassfish 3.1 with war packaging.
Merchant isn't the only subclass of UserAccount and the other 
@DiscriminatorValue annotated classes aren't getting picked-up either.
I've not got any xml mapping files and I've tried explicitly listing all entity 
classes in persistence.xml, which doesn't make any difference.
I'm a bit stumped!
-Phill


On 21/apr/2011, at 17.11, Michael Dick wrote:

> Hi Phill,
> 
> The snippets from your entities are correct. Which version of OpenJPA are
> you using, and how do you do enhancement?
> 
> Could the app be picking up an old version of Merchant that doesn't have the
> annotation, or an XML mapping file that reset it to a different value?
> 
> -mike
> 
> On Wed, Apr 20, 2011 at 9:39 AM, Phill <gdoe6...@yahoo.it> wrote:
> 
>> I'm having some trouble with joined inheritance, my mappings are as follows
>> but OpenJPA doesn't seem to be picking up my @DiscriminatorValue.
>> Probably missing something obvious but can't see what... any suggestions
>> much appreciated
>> 
>> @Entity
>> @Table(name = "user_account")
>> @Inheritance(strategy = InheritanceType.JOINED)
>> @DiscriminatorColumn(name = "account_type", discriminatorType =
>> DiscriminatorType.STRING)
>> public abstract class UserAccount implements Serializable {
>> ...
>> 
>> @Entity
>> @Table(name = "merchant")
>> @DiscriminatorValue("MERCHANT")
>> @PrimaryKeyJoinColumn(name = "merchant_id", referencedColumnName =
>> "account_id")
>> public class Merchant extends UserAccount {
>> ...
>> 
>> java.lang.ClassNotFoundException: Could not map discriminator value
>> "MERCHANT" to any known subclasses of the requested class
>> "my.app.model.UserAccount" (known discriminator values: [UserAccount]).
>>    at
>> org.apache.openjpa.jdbc.meta.strats.ValueMapDiscriminatorStrategy.getClass(ValueMapDiscriminatorStrategy.java:98)
>>    at
>> org.apache.openjpa.jdbc.meta.strats.InValueDiscriminatorStrategy.getClass(InValueDiscriminatorStrategy.java:121)
>>    at
>> org.apache.openjpa.jdbc.meta.Discriminator.getClass(Discriminator.java:398)
>>    at
>> org.apache.openjpa.jdbc.meta.strats.SuperclassDiscriminatorStrategy.getClass(SuperclassDiscriminatorStrategy.java:63)
>>    at
>> org.apache.openjpa.jdbc.meta.Discriminator.getClass(Discriminator.java:398)
>>    at
>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:397)
>>    at
>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:333)
>>    at
>> org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
>>    at
>> org.apache.openjpa.datacache.DataCacheStoreManager.initialize(DataCacheStoreManager.java:360)
>>    at
>> org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
>>    at
>> org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
>>    at
>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1022)
>>    at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:980)
>>    at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:902)
>>    at
>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1041)
>>    at
>> org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280)
>>    at
>> org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2381)
>>    at
>> org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:274)
>>    at
>> org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:59)
>>    at
>> org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:36)
>>    at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1251)
>>    at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1007)
>>    at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863)
>>    at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
>>    at
>> org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
>>    at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:305)
>>    at
>> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:319)

Reply via email to