Re: ArgumentException: No metadata was found
Yes, I'm using two different persistence units: one for classes [a, x, y , z] and the other for classes [b, c, d, e, f]. How is that possible they're switched? Is it a known bug? -- View this message in context: http://n2.nabble.com/ArgumentException-No-metadata-was-found-tp4859707p4935649.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ArgumentException: No metadata was found
Yes, the type a valid entity and it's listed in the p.xml file (otherwise I would have get this exception during startup and not after a month..) I'm using 2 different entity managers: The first contains the classes: a, x, y, z. and the second contains the classes: b, c, d, e, f. when i'm trying to find entity A, i'm using the first entity manager. but it looks like it refers to the second entity manager when it says "The class does no appear in the list of persistent types: [b, c, d, e, f, etc] " is it possible that it switched between the two entity managers? -- View this message in context: http://n2.nabble.com/ArgumentException-No-metadata-was-found-tp4859707p4906100.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
ArgumentException: No metadata was found
Hey, I'm using OpenJPA 1.2.0. My application was running for about a month, when I suddenly got the following exception: org.apache.openjpa.persistence.ArgumentException: No metadata was found for type "class A". The class does no appear in the list of persistent types: [b, c, d, e, f, etc] at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:303) at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1114) at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:268) at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:451) ... The strange thing is that I usually get this exception if the entity manager use a new class, and it's not appear in the persistence.xml file. But now this error occurred after the application was up for about a month. Does anyone know this problem? Thanks, Udi -- View this message in context: http://n2.nabble.com/ArgumentException-No-metadata-was-found-tp4859707p4859707.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
RE: ClassCastException in pcReplaceField
Hey Russel, I just added the Comparable implementation, and I hope this will solve the problem. Thanks, Udi -- View this message in context: http://n2.nabble.com/ClassCastException-in-pcReplaceField-tp4392185p4459284.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
RE: ClassCastException in pcReplaceField
P.S. - I forgot to mention that I'm enhanching at runtime using javaagent. -- View this message in context: http://n2.nabble.com/ClassCastException-in-pcReplaceField-tp4392185p4407523.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
RE: ClassCastException in pcReplaceField
http://n2.nabble.com/file/n4407518/2.pdf 2.pdf That's the stack trace. mypackage, A and B is my stuff. Hope this can be of more use... Thanks, Udi -- View this message in context: http://n2.nabble.com/ClassCastException-in-pcReplaceField-tp4392185p4407518.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
RE: ClassCastException in pcReplaceField
Hey Russell, Thanks for the reply. I don't think I understand what you offered. (By IComparable - I assume you meant simply Comparable) A and B are not comparable objects. They are entirely different object, and that is why it's so strange... I'm posting the stack trace in a few moments.. Russell Collins wrote: > > It looks like you are trying to add items to a Set. You will get these > casting exceptions if your classes do not implement the IComparable > interface. If they do implement the interface, then it is another issue. > -- View this message in context: http://n2.nabble.com/ClassCastException-in-pcReplaceField-tp4392185p4407472.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
ClassCastException in pcReplaceField
Hey, first of all, I'm sorry for not pasting the stack - I just can't. I'm using OpenJPA 1.2.0 I have 2 classes: class A{ @OneToMany(mappedBy="a") Set } class B{ @ManyToOne A a; } Now, at some point (I can't create a consistent testcase..) I get ClassCastException: B cannot be cast to A. The stack (typed, so sorry once again...): B.pcReplaceField() StateManagerImpl.replaceField() StateManagerImpl.storeObjectField() StateManagerImpl.storeObject() RelationFieldStrategy.load() FieldMapping.load() JDBCStoreManager.load() I'm enhancing entities at runtime, so I used decompiler to see the generated class, and in the problematic line it appears like a cast for a field. Anyone knows how can it happen (and even more interesting - how to solve the problem? :) ) Thanks, Udi -- View this message in context: http://n2.nabble.com/ClassCastException-in-pcReplaceField-tp4392185p4392185.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Rollback - Transaction issue
Hey, Is there any way to "replay" transaction? I mean, sometimes I get RollbackException and rollback the transaction. Can I then "clone" the transaction and try again, or once rollback is called, transaction is lost? I really need the changes, and really don't want to trace every change for rerunning later... thanks, udi -- View this message in context: http://n2.nabble.com/Rollback-Transaction-issue-tp3937521p3937521.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
OptimisticLockException problem
Hey, My application have few EntityManagers. Each EM, works on a different Thread. I configured openjpa.Optimistic to false and openjpa.Multithreaded to true. (Though Im not sure its related) I get the following exception (sorry for not pasting the full stack... I just can't): org.apache.openjpa.persistence.OptimisticLockException: an optimistic lock violation was detected when flushing objects instance "bla.A-110" to the data store. This indicates that the object was cocurrently modified in another transaction. failed object: bla.A-bla.A-110 at or.apache...BatchingPreparedStatementManagerImpl.checkUpdateCount(284) ... ... How can I get this concurrent modification if any EM uses different thread and connection? I'm using OpenJPA 1.2.0, btw... Thanks, Udi -- View this message in context: http://n2.nabble.com/OptimisticLockException-problem-tp3930693p3930693.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
No metadata was found..
I think this might have a bit with my last post. I have a few persisted classes which I enhance at runtime. The application than persisting a specific type all the time: A. At some time I get the following exception: org.apache.openjpa.persis tence.ArgumentException: No metadata was found for type "class app.A". The class does not apear in the list of persistent types: [app.B, app.C] Class A is in a different persistent unit than B and C. After this one time (and sometimes twice) - A's are successfully persisted. Is there any way openjpa decides to load PUs again? Or any reason why only 1 PU is active at some point? thaks, Udi -- View this message in context: http://n2.nabble.com/No-metadata-was-found..-tp3383051p3383051.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
EntityExistsException issue
Hey, I have this case: class Book{ @id protected long id; private static number = 0; @prePersist private void makeSomeID(){ id = ++number; } } class Persister{ public static void main(...){ while (true){ em.persist(new Book()); } } } I don't know why I sometimes get EntityExistsException. The openJPA documentation says nothing about this exception. Why do I get it? ps - I know it's not compiling, I just can't copy the code from the workspace... thanks Udi -- View this message in context: http://n2.nabble.com/EntityExistsException-issue-tp3377645p3377645.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: Runtime enhancement fails
Hey Rick, I passed the problem by removing the other persistence.xml. I'm using runtime enhancement, and by debuging I noticed that in some point the enhancer makes parsed.parse() for each peristence.xml. When the parsing ends, only the last parse is taking in count (within the parser._result) and that is the wrong persistence.xml in my case.. I'm pretty sure it's a bug.. On Tue, Jun 16, 2009 at 6:06 PM, Rick Curtis (via Nabble) < ml-user+172967-154794...@n2.nabble.com > wrote: > Udi - > > I wasn't able to find any changes from 1.0.1 -> 1.2.0 that would affect > your application, can you post some more information? > > Are you using buildtime or runtime enhancement? When you are enhancing, is > it possible that you are setting addDefaultConstructor to false? > > -Rick > > Udi wrote: > Hey, > I upgraded the OpenJPA version from 1.0.1 to 1.2.0 > Now my application fails due to missing no-args constructor. > I checked and noticed that the enhancer works on a persistence.xml locating > in another jar (which is part of my application, but not the wanted xml). > My persistence.xml is in the same META-INF as it was before but the > enhancer still won't see it. > > Was something changed with enhancement? > > > > -- > This email is a reply to your post @ > http://n2.nabble.com/Runtime-enhancement-fails-tp3078746p3086895.html > You can reply by email or by visting the link above. > > -- View this message in context: http://n2.nabble.com/Runtime-enhancement-fails-tp3078746p3087372.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Runtime enhancement fails
Hey, I upgraded the OpenJPA version from 1.0.1 to 1.2.0 Now my application fails due to missing no-args constructor. I checked and noticed that the enhancer works on a persistence.xml locating in another jar (which is part of my application, but not the wanted xml). My persistence.xml is in the same META-INF as it was before but the enhancer still won't see it. Was something changed with enhancement? -- View this message in context: http://n2.nabble.com/Runtime-enhancement-fails-tp3078746p3078746.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ArrayIndexOutOfBoundsException in ApplicationIds
I found the reason - OPENJPA-815. -- View this message in context: http://n2.nabble.com/ArrayIndexOutOfBoundsException-in-ApplicationIds-tp3048008p3048059.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
ArrayIndexOutOfBoundsException in ApplicationIds
Hey, I just upgrated my OpenJPA version from 1.0.1 to 1.2.0, and I get ArrayIndexOutOfBoundsException in ApplicationIds. I have an embedded entity, that has a ManyToOne field. I noticed that in some point when i'm loading the manyToOne field, it takes the _owner class and tries to retrieve its PK. The thing is the embedded has no PK and then the exception is thrown. Any ideas? thanks, Udi -- View this message in context: http://n2.nabble.com/ArrayIndexOutOfBoundsException-in-ApplicationIds-tp3048008p3048008.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
RE: NullPointerException in pcReplaceField
Hey Ravi, Thanks for the comment. "Tree" is indeed an embedded object... What did you do with this exception? -- View this message in context: http://n2.nabble.com/NullPointerException-in-pcReplaceField-tp2979657p2980726.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
NullPointerException in pcReplaceField
Hey, I don't know yet how to force this situation, but it happens a lot: I get a NullPointerException caused by pcReplaceField. I can't paste the stack but it goes something like: ... caused bu: java.lang.NullPointerException at MyProjrct.entities.Tree.pcReplaceField(Tree) and here some statemanager calls. I'm pretty sure that the exception is not caused because of a detached entity.. Is there any known issue for that? What can cause this exception? thanks, Udi -- View this message in context: http://n2.nabble.com/NullPointerException-in-pcReplaceField-tp2979657p2979657.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
ArgumentException in refresh()
Hey, In our program we have the next lines: if (!em.find(entity.id , entity.getClass())) return; entity.refresh(); sometimes we get ArgumentException in the refresh line. The cause is that the entity is not managed by this context. When we use em.contains(entity), the return value is false, but in other cases this is not enough and an EntityNotFoundException is thorwn. Is it needed to check both - contains and find? (our application is multithreaded) thanks, Michael and Udi -- View this message in context: http://n2.nabble.com/ArgumentException-in-refresh%28%29-tp2552644p2552644.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: EntityNotFoundException in find()
I minimized the places I get EntityNotFoundException to a single refresh line. I just can't figure out what the problem is: if (!em.contains(entity)) return; em.refresh(entity); -> EntityNotFoundException sometimes... What do I do wrong? How can I tell that the entity is not managed anymore? -- View this message in context: http://n2.nabble.com/EntityNotFoundException-in-find%28%29-tp2231065p2428016.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: "detected possible orphaned..."
Hey pinaki, thanks for the comment, sorry for the late response... I did'nt try build-time anhancement, cause I found sort of solution. I found out that refresh() works a bit different, therefore when I first handle a new entity, I do em.refresh(entity) and the entity's fields are fully updated afterwards. Thanks anyway -- View this message in context: http://n2.nabble.com/%22detected-possible-orphaned...%22-tp2339495p2427979.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
"detected possible orphand..."
Hey, I faced the warning: detected possible orphand to deleted object "test.House-123" in "test.House.owner". I read that this might be a bug in openJPA, and in JIRA I read that if the problem happens in Many-to-one relation, the @Nonpolymorphic can resolve the issue. The thing is I must use polymorphic objects. These are my classes: class House { @ManyToOne private Owner owner; } abstract class Owner { } class BigOwner extends Owner { } class SmallOwner extends Owner { } Obviously, house's field owner must be of BigOwner or SmallOwner. Is there any solution for this case? thanks, Udi -- View this message in context: http://n2.nabble.com/%22detected-possible-orphand...%22-tp2339495p2339495.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
EntityNotFoundException in find()
Hey, I'm facing a situation where I try accessing entities from bunch of different places, and sometimes (after deletion) I get EntityNotFoundException. I just can't find a way that I can synchronize things. Is the EntityNotFoundException a normal thing? How can I handle this? thanks Udi -- View this message in context: http://n2.nabble.com/EntityNotFoundException-in-find%28%29-tp2231065p2231065.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: Problem retrieving Timestamp from persistance
Hey, thanx for the comment, sorry it took me a while.. I can't paste my code, but I can explain better: I do: MapMessage m = TopicSubscriber.receive(); for each field in the message: Object value = m.getObject(SomeIndex); Now, when the fields are int, long, String etc. it work just fine, and the object returned are Integer, Long String... But, when the field type is Timestamp, the getObject() return String by default. The result is a ugly String which needs to be formatted to Date. The thing is I don't want to give up on the generic call to getObject(). The optimal thing for me was to be able to replace the default getObject() considering Date to return Date object. Is there a way to perform such thing? Dinkar Rao wrote: > > Since java.sql.Timestamp extends java.util.Date, a get() on the > Timestamp field should already return Date... > > ...unless I totally misunderstood your question. Can you paste your > entity definition and a simple test ? > > Thanks, > Dinkar > > -- View this message in context: http://n2.nabble.com/Problem-retrieving-Timestamp-from-persistance-tp2108549p2151359.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Problem retrieving Timestamp from persistance
Hello, I have a small application that persist a few fields. One of the types is timestamp. When an XLA event is fired, and I try to read the timestamp field, it returns as an ugly string. Now, I know that the default for getObject of timestamp type is string, but is there a way to change the default, so it'll return Date? Thanx, Udi -- View this message in context: http://n2.nabble.com/Problem-retrieving-Timestamp-from-persistance-tp2108549p2108549.html Sent from the OpenJPA Users mailing list archive at Nabble.com.