openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roozbeh <roozbehmaad...@yahoo.com>
Subject Re: Strange exception while running test cases for kodo
Date Wed, 13 Dec 2006 13:04:38 GMT

Thanks I found the problem:

The problem was that I was running the command "mvn clean install -o" which
somehow messesup the compiled classes so I first ran mvn clean and then mvn
install and everything works fine


Marc Prud wrote:
> 
> 
> I've seen this sort of thing happen if both Account and  
> IdentifiablePersistentEntity are enhanced, but then the  
> IdentifiablePersistentEntity superclass is recompiled so that it is  
> no longer enhanced. Is this possible? Are you manually enhancing, or  
> using the dynamic class enhancement?
> 
> If you run javap on both IdentifiablePersistentEntity and Account,  
> what do you see?
> 
> 
> 
> 
> 
> On Dec 12, 2006, at 2:16 AM, Roozbeh wrote:
> 
>>
>> This is the source for IdentifiablePersistentEntity:
>>
>> package framework.persistence;
>>
>> import java.util.Collection;
>>
>> import javax.jdo.PersistenceManager;
>> import javax.jdo.Query;
>>
>> import framework.id.Id;
>>
>> /**
>>  * Base class for all persistent objects that have an identifier.
>>  */
>> public abstract class IdentifiablePersistentEntity extends  
>> PersistentEntity
>> {
>>
>>   private long iId;
>>
>>   /*
>>    * Persistence methods
>>    */
>>   public Id makePersistent() {
>>     PersistenceManager pm = JdoPmFactorySingleton.instance().getPm();
>>     pm.makePersistent(this);
>>     return getId();
>>   }
>>
>>   public Id getId() {
>>     return new Id(getIdClass(), iId);
>>   }
>>
>>   /**
>>    * Should return the class used for the ID object.
>>    *
>>    * @return The current class or any of its domain object ancestors
>>    */
>>   protected abstract Class getIdClass();
>>
>>   public static IdentifiablePersistentEntity findById(Id id) {
>>     PersistenceManager pm = JdoPmFactorySingleton.instance().getPm();
>>     Query q = pm.newQuery(id.getObjectType(), "iId == :id");
>>     Collection<IdentifiablePersistentEntity> rSet =
>> (Collection<IdentifiablePersistentEntity>) q.execute(id.getValue());
>>     if (rSet.size() > 1)
>>       throw new RuntimeException("Ambigous query: " + id.getValue()  
>> + "::" +
>> rSet.size());
>>     else if (rSet.isEmpty())
>>       return null;
>>     else
>>       return rSet.iterator().next();
>>   }
>>
>>   public String toString() {
>>     return (isPersistent() ? getId().toString() : "<non-persistent>");
>>   }
>>
>> }
>>
>>
>> and this is the source for persistententity:
>>
>> package framework.persistence;
>>
>> import java.util.Calendar;
>> import java.util.Date;
>>
>> import javax.jdo.JDOHelper;
>> import javax.jdo.PersistenceManager;
>>
>>
>> import kodo.jdo.KodoPersistenceManager;
>>
>> /**
>>  * Base class of all first class persistent objects.
>>  */
>> public abstract class PersistentEntity {
>>
>>   /*
>>    * Persistence methods
>>    */
>>   public Object makePersistent() {
>>     PersistenceManager pm = JdoPmFactorySingleton.instance().getPm();
>>     pm.makePersistent(this);
>>     return pm.getObjectId(this);
>>   }
>>
>>   public Object getJdoId() {
>>     PersistenceManager pm = JdoPmFactorySingleton.instance().getPm();
>>     return pm.getObjectId(this);
>>   }
>>
>>   public boolean isPersistent() {
>>     return JDOHelper.isPersistent(this);
>>   }
>>
>>   public static PersistentEntity findByJdoId(Object id) {
>>     PersistenceManager pm = JdoPmFactorySingleton.instance().getPm();
>>     return (PersistentEntity) pm.getObjectById(id, false);
>>   }
>>
>>   public static PersistentEntity findByJdoIdString(String idString) {
>>     return null;
>>   }
>>
>>   public void deletePersistent() {
>>     PersistenceManager pm = JdoPmFactorySingleton.instance().getPm();
>>     pm.deletePersistent(this);
>>   }
>>
>>
>>   public PersistentEntity detach() {
>>     KodoPersistenceManager pm = (KodoPersistenceManager)
>> JdoPmFactorySingleton.instance().getPm();
>>     return (PersistentEntity) pm.detachCopy(this);
>>   }
>>
>>
>>
>>   public PersistentEntity attach() {
>>     KodoPersistenceManager pm = (KodoPersistenceManager)
>> JdoPmFactorySingleton.instance().getPm();
>>     return (PersistentEntity) pm.attachCopy(this,true);
>>   }
>>
>>
>>   public String toString() {
>>     return (isPersistent() ? getJdoId().toString() : "<non- 
>> persistent>");
>>   }
>>
>>   public static Date setTimeComponents(Date date, int hour, int  
>> minute, int
>> second, int milliSecond) {
>>     Calendar cal = Calendar.getInstance();
>>     cal.setTime(date);
>>     cal.set(Calendar.HOUR_OF_DAY, hour);
>>     cal.set(Calendar.MINUTE, minute);
>>     cal.set(Calendar.SECOND, second);
>>     cal.set(Calendar.MILLISECOND, milliSecond);
>>     return cal.getTime();
>>   }
>> }
>>
>> and we are using maven for running the test cases and the we are  
>> developing
>> services on Servicemix.
>>
>>
>>
>>
>> Patrick Linskey wrote:
>>>
>>> How are you deploying your application? (J2EE, J2SE, ...)
>>>
>>> Can you post the source to the classes, or at least
>>> IdentifiablePersistentEntity?
>>>
>>> -Patrick
>>>
>>> -- 
>>> Patrick Linskey
>>> BEA Systems, Inc.
>>>
>>> _____________________________________________________________________ 
>>> __
>>> Notice:  This email message, together with any attachments, may  
>>> contain
>>> information  of  BEA Systems,  Inc.,  its subsidiaries  and   
>>> affiliated
>>> entities,  that may be confidential,  proprietary,  copyrighted   
>>> and/or
>>> legally privileged, and is intended solely for the use of the  
>>> individual
>>> or entity named in this message. If you are not the intended  
>>> recipient,
>>> and have received this message in error, please immediately return  
>>> this
>>> by email and then delete it.
>>>
>>>> -----Original Message-----
>>>> From: Roozbeh [mailto:roozbehmaadani@yahoo.com]
>>>> Sent: Tuesday, December 12, 2006 1:25 AM
>>>> To: open-jpa-dev@incubator.apache.org
>>>> Subject: Strange exception while running test cases for kodo
>>>>
>>>>
>>>> Hi!
>>>>
>>>> I have a simple class called Account which inherits form
>>>> IdentifiablePersistentEntity and when I want to create
>>>> Account object I got
>>>> this error:
>>>>
>>>> "java.lang.NoSuchMethodError:
>>>> IdentifiablePersistentEntity.pcGetManagedFieldCount() I"
>>>>
>>>> Does anyone have any Idea?
>>>>
>>>> Regards,
>>>> Roozbeh Maadani
>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/Strange-exception-while-running-test-cas
>>>> es-for-kodo-tf2806392.html#a7829863
>>>> Sent from the open-jpa-dev mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/Strange- 
>> exception-while-running-test-cases-for-kodo-tf2806392.html#a7830452
>> Sent from the open-jpa-dev mailing list archive at Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Strange-exception-while-running-test-cases-for-kodo-tf2806392.html#a7852393
Sent from the open-jpa-dev mailing list archive at Nabble.com.


Mime
View raw message