Re: MetaModel creation with -Aopenjpa.generate=true
Thats exactly what i am trying the last 10 minutes but its not that easy because he doesnt process alphabetically or something. In fact i have more than 30 entities which are not processed. One of those is the problem of course. the compilerarg value=-Aopenjpa.log=TRACE/ thingy doesnt reveal very much. I just see many lines like these: [javac] Note: Generating canonical metamodel source code src/de/netversys/domain/JobTrigger_.java [javac] Note: Generating canonical metamodel source code src/de/netversys/domain/Label_.java ... Dont even know if this is a trace output or just the usual clutter which comes out anyway. Debugging is also not that easy within an ANT process. Perhaps someone give me an hint how to proceed. I really dont want to recompile the AnnotationProcessor6 class. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 15:51 schrieb Rick Curtis: Marc - Can you narrow down the Entity which is having the problem so we can write a unit test? Thanks, Rick
Re: MetaModel creation with -Aopenjpa.generate=true
one more thing. You have something like this in the second process() method: private boolean process(TypeElement e) { catch (Exception e1) { logger.error(_loc.get(mmg-process-error, e.getQualifiedName()), e1); return false; } finally { ... This is cool if get an error in the real process but this one here: public boolean process(Set? extends TypeElement annos, RoundEnvironment roundEnv) { if (active !roundEnv.processingOver()) { Set? extends Element elements = roundEnv.getRootElements(); for (Element e : elements) { process((TypeElement) e); } } } is the caller and we dont have any logging here if the cast fails. This leaves a user in a unpleasant situation when something goes wrong on that line (as it is with my situation). As every java developer know a cast can fail and i would like to see a logging for that to and a re-throw after that. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 15:51 schrieb Rick Curtis: Marc - Can you narrow down the Entity which is having the problem so we can write a unit test? Thanks, Rick
Re: MetaModel creation with -Aopenjpa.generate=true
Correction: With my program, i get a result of course because i dont leave the process on error ;-) But this is the solution. This is NOT the solution i meant. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:38 schrieb Marc Logemann: Puuuh. Its me again. I am gone the hard route and created my own variant of AnnotationProcesso: @Override public boolean process(Set? extends TypeElement annos, RoundEnvironment roundEnv) { if (active !roundEnv.processingOver()) { Set? extends Element elements = roundEnv.getRootElements(); for (Element e : elements) { try { System.out.println(Element inside Set -- + e); process((TypeElement) e); } catch (RuntimeException e1) { System.out.println(Error --+ e); } } } return true; } with more logging and something strange can be seen: ... [javac] Element inside Set -- de.netversys.carriers.tourline.process.TourlineRoutingBarcode [javac] Element inside Set -- de.netversys.carriers.tourline.process.TourlineSenderBarcode [javac] Element inside Set -- de.netversys.carriers.bartolini.domain.xml [javac] Error --de.netversys.carriers.bartolini.domain.xml The -- lines is the output before the process() call in the for loop which i coded in there. The last line is interessting. This is not a class, this is a package! (with JAXB generated stuff in it) Now the error message java.lang.ClassCastException: com.sun.tools.javac.code.Symbol$PackageSymbol cannot be cast to javax.lang.model.element.TypeElement makes sense because he says something about PackageSymbol. Now more questions comes up than it solves. Why is this package inside the Element Set ?? Its a normal package under one of my domain packages. But inside this package, there are only JAXB generated classes. Perhaps JAXB generated classe with its ObjectFactory stuff is handled differently by the JDK Annotation framework. But i have other places with JAXB stuff in it. Cant be the issue. With my program, i get a result of course because i dont leave the process on error ;-) But this is the solution. still a bit clueless -- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 15:51 schrieb Rick Curtis: Marc - Can you narrow down the Entity which is having the problem so we can write a unit test? Thanks, Rick
Re: MetaModel creation with -Aopenjpa.generate=true
still a bit clueless Me too. I just started digging into some of the annotation processor code to see if I can learn something today So when you swallowed the exception everything worked fine? Thanks, Rick
Re: MetaModel creation with -Aopenjpa.generate=true
For the time being, how about the following fix in openjpa trunk: /** * The entry point for java compiler. */ @Override public boolean process(Set? extends TypeElement annos, RoundEnvironment roundEnv) { if (active !roundEnv.processingOver()) { Set? extends Element elements = roundEnv.getRootElements(); for (Element e : elements) { if (e instanceof TypeElement) process((TypeElement) e); } } return true; } We simply ignore PackageElement, ExecutableElement, TypeParameterElement and VariableElement. (These are the other Subinterfaces of Element) With this we dont get into trouble and we have time to elaborate on the real problem. roundEnv.getRootElements() simply can return also PackageElements. Why this is only the case for this package with JAXB file is something which one need to research. Thats definitely something in the javax.annotation.processing area of the JDK. But there must be a reason that getRootElements() returns Element and not TypeElement ;-) --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:41 schrieb Rick Curtis: still a bit clueless Me too. I just started digging into some of the annotation processor code to see if I can learn something today So when you swallowed the exception everything worked fine? Thanks, Rick
Re: MetaModel creation with -Aopenjpa.generate=true
Yes that seems reasonable. I'll get that taken care of sometime this afternoon. I'd like to get another JIRA opened up to investigate the JAXB packageElements problem Thanks, Rick On Wed, Mar 23, 2011 at 10:51 AM, Marc Logemann l...@logemann.org wrote: For the time being, how about the following fix in openjpa trunk: /** * The entry point for java compiler. */ @Override public boolean process(Set? extends TypeElement annos, RoundEnvironment roundEnv) { if (active !roundEnv.processingOver()) { Set? extends Element elements = roundEnv.getRootElements(); for (Element e : elements) { if (e instanceof TypeElement) process((TypeElement) e); } } return true; } We simply ignore PackageElement, ExecutableElement, TypeParameterElement and VariableElement. (These are the other Subinterfaces of Element) With this we dont get into trouble and we have time to elaborate on the real problem. roundEnv.getRootElements() simply can return also PackageElements. Why this is only the case for this package with JAXB file is something which one need to research. Thats definitely something in the javax.annotation.processing area of the JDK. But there must be a reason that getRootElements() returns Element and not TypeElement ;-) --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:41 schrieb Rick Curtis: still a bit clueless Me too. I just started digging into some of the annotation processor code to see if I can learn something today So when you swallowed the exception everything worked fine? Thanks, Rick
Re: MetaModel creation with -Aopenjpa.generate=true
Hi, hope i could help a bit in researching this. For now i will use my own variant of AnnotationProcessor6. BTW it was a bit of a mess to create my own version of this class because SourceAnnotationHandler.class has a lot of package private methods which are used by AnnotationProcessor6. So i also needed to clone that class too. g. :-) I am quite sure that there are not that much people out there using the MetaModel feature at all. Because first you need to use Criteria API which is probably also not THAT widespreaded so far. This could be the reason why this bug is not mentioned somwhere. But software development is crazy. You start using Criteria API because its somewhat typesafe in conjunction with MetaModel and now you are fighting with AnnotationProcessor. Not really where we make our money. But on the other hand its a challenge to find out why things break. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:55 schrieb Rick Curtis: Yes that seems reasonable. I'll get that taken care of sometime this afternoon. I'd like to get another JIRA opened up to investigate the JAXB packageElements problem Thanks, Rick On Wed, Mar 23, 2011 at 10:51 AM, Marc Logemann l...@logemann.org wrote: For the time being, how about the following fix in openjpa trunk: /** * The entry point for java compiler. */ @Override public boolean process(Set? extends TypeElement annos, RoundEnvironment roundEnv) { if (active !roundEnv.processingOver()) { Set? extends Element elements = roundEnv.getRootElements(); for (Element e : elements) { if (e instanceof TypeElement) process((TypeElement) e); } } return true; } We simply ignore PackageElement, ExecutableElement, TypeParameterElement and VariableElement. (These are the other Subinterfaces of Element) With this we dont get into trouble and we have time to elaborate on the real problem. roundEnv.getRootElements() simply can return also PackageElements. Why this is only the case for this package with JAXB file is something which one need to research. Thats definitely something in the javax.annotation.processing area of the JDK. But there must be a reason that getRootElements() returns Element and not TypeElement ;-) --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:41 schrieb Rick Curtis: still a bit clueless Me too. I just started digging into some of the annotation processor code to see if I can learn something today So when you swallowed the exception everything worked fine? Thanks, Rick
Re: MetaModel creation with -Aopenjpa.generate=true
BTW it was a bit of a mess to create my own version of this class because SourceAnnotationHandler.class has a lot of package private methods which are used by AnnotationProcessor6. So i also needed to clone that class too. g. :-) I could easily create a patch to put on top of the existing AnnotationProcessor6 if that would make your life easier? (You're running 2.1.x right?) I am quite sure that there are not that much people out there using the MetaModel feature at all. Because first you need to use Criteria API which is probably also not THAT widespreaded so far. This could be the reason why this bug is not mentioned somewhere. +1 Thanks, Rick On Wed, Mar 23, 2011 at 11:03 AM, Marc Logemann l...@logemann.org wrote: Hi, hope i could help a bit in researching this. For now i will use my own variant of AnnotationProcessor6. BTW it was a bit of a mess to create my own version of this class because SourceAnnotationHandler.class has a lot of package private methods which are used by AnnotationProcessor6. So i also needed to clone that class too. g. :-) I am quite sure that there are not that much people out there using the MetaModel feature at all. Because first you need to use Criteria API which is probably also not THAT widespreaded so far. This could be the reason why this bug is not mentioned somwhere. But software development is crazy. You start using Criteria API because its somewhat typesafe in conjunction with MetaModel and now you are fighting with AnnotationProcessor. Not really where we make our money. But on the other hand its a challenge to find out why things break. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:55 schrieb Rick Curtis: Yes that seems reasonable. I'll get that taken care of sometime this afternoon. I'd like to get another JIRA opened up to investigate the JAXB packageElements problem Thanks, Rick On Wed, Mar 23, 2011 at 10:51 AM, Marc Logemann l...@logemann.org wrote: For the time being, how about the following fix in openjpa trunk: /** * The entry point for java compiler. */ @Override public boolean process(Set? extends TypeElement annos, RoundEnvironment roundEnv) { if (active !roundEnv.processingOver()) { Set? extends Element elements = roundEnv.getRootElements(); for (Element e : elements) { if (e instanceof TypeElement) process((TypeElement) e); } } return true; } We simply ignore PackageElement, ExecutableElement, TypeParameterElement and VariableElement. (These are the other Subinterfaces of Element) With this we dont get into trouble and we have time to elaborate on the real problem. roundEnv.getRootElements() simply can return also PackageElements. Why this is only the case for this package with JAXB file is something which one need to research. Thats definitely something in the javax.annotation.processing area of the JDK. But there must be a reason that getRootElements() returns Element and not TypeElement ;-) --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:41 schrieb Rick Curtis: still a bit clueless Me too. I just started digging into some of the annotation processor code to see if I can learn something today So when you swallowed the exception everything worked fine? Thanks, Rick
Re: MetaModel creation with -Aopenjpa.generate=true
+1 for the patch on AnnotationProcessor6 for the 2.1.x release line. Of course this would make my life easier. I could drop my own variant. I always like using framework classes instead of patched-own-versions. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 17:20 schrieb Rick Curtis: BTW it was a bit of a mess to create my own version of this class because SourceAnnotationHandler.class has a lot of package private methods which are used by AnnotationProcessor6. So i also needed to clone that class too. g. :-) I could easily create a patch to put on top of the existing AnnotationProcessor6 if that would make your life easier? (You're running 2.1.x right?) I am quite sure that there are not that much people out there using the MetaModel feature at all. Because first you need to use Criteria API which is probably also not THAT widespreaded so far. This could be the reason why this bug is not mentioned somewhere. +1 Thanks, Rick On Wed, Mar 23, 2011 at 11:03 AM, Marc Logemann l...@logemann.org wrote: Hi, hope i could help a bit in researching this. For now i will use my own variant of AnnotationProcessor6. BTW it was a bit of a mess to create my own version of this class because SourceAnnotationHandler.class has a lot of package private methods which are used by AnnotationProcessor6. So i also needed to clone that class too. g. :-) I am quite sure that there are not that much people out there using the MetaModel feature at all. Because first you need to use Criteria API which is probably also not THAT widespreaded so far. This could be the reason why this bug is not mentioned somwhere. But software development is crazy. You start using Criteria API because its somewhat typesafe in conjunction with MetaModel and now you are fighting with AnnotationProcessor. Not really where we make our money. But on the other hand its a challenge to find out why things break. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:55 schrieb Rick Curtis: Yes that seems reasonable. I'll get that taken care of sometime this afternoon. I'd like to get another JIRA opened up to investigate the JAXB packageElements problem Thanks, Rick On Wed, Mar 23, 2011 at 10:51 AM, Marc Logemann l...@logemann.org wrote: For the time being, how about the following fix in openjpa trunk: /** * The entry point for java compiler. */ @Override public boolean process(Set? extends TypeElement annos, RoundEnvironment roundEnv) { if (active !roundEnv.processingOver()) { Set? extends Element elements = roundEnv.getRootElements(); for (Element e : elements) { if (e instanceof TypeElement) process((TypeElement) e); } } return true; } We simply ignore PackageElement, ExecutableElement, TypeParameterElement and VariableElement. (These are the other Subinterfaces of Element) With this we dont get into trouble and we have time to elaborate on the real problem. roundEnv.getRootElements() simply can return also PackageElements. Why this is only the case for this package with JAXB file is something which one need to research. Thats definitely something in the javax.annotation.processing area of the JDK. But there must be a reason that getRootElements() returns Element and not TypeElement ;-) --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:41 schrieb Rick Curtis: still a bit clueless Me too. I just started digging into some of the annotation processor code to see if I can learn something today So when you swallowed the exception everything worked fine? Thanks, Rick
Re: MetaModel creation with -Aopenjpa.generate=true
Marc - Give this[1] patch a shot. If you can help me come up with a test Entity model that exposes this problem I have a pretty good chance of being able to get it into 2.1.1. [1] http://people.apache.org/~curtisr7/patches/annotation_processor_patch.jar Thanks, Rick On Wed, Mar 23, 2011 at 11:29 AM, Marc Logemann l...@logemann.org wrote: +1 for the patch on AnnotationProcessor6 for the 2.1.x release line. Of course this would make my life easier. I could drop my own variant. I always like using framework classes instead of patched-own-versions. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 17:20 schrieb Rick Curtis: BTW it was a bit of a mess to create my own version of this class because SourceAnnotationHandler.class has a lot of package private methods which are used by AnnotationProcessor6. So i also needed to clone that class too. g. :-) I could easily create a patch to put on top of the existing AnnotationProcessor6 if that would make your life easier? (You're running 2.1.x right?) I am quite sure that there are not that much people out there using the MetaModel feature at all. Because first you need to use Criteria API which is probably also not THAT widespreaded so far. This could be the reason why this bug is not mentioned somewhere. +1 Thanks, Rick On Wed, Mar 23, 2011 at 11:03 AM, Marc Logemann l...@logemann.org wrote: Hi, hope i could help a bit in researching this. For now i will use my own variant of AnnotationProcessor6. BTW it was a bit of a mess to create my own version of this class because SourceAnnotationHandler.class has a lot of package private methods which are used by AnnotationProcessor6. So i also needed to clone that class too. g. :-) I am quite sure that there are not that much people out there using the MetaModel feature at all. Because first you need to use Criteria API which is probably also not THAT widespreaded so far. This could be the reason why this bug is not mentioned somwhere. But software development is crazy. You start using Criteria API because its somewhat typesafe in conjunction with MetaModel and now you are fighting with AnnotationProcessor. Not really where we make our money. But on the other hand its a challenge to find out why things break. --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:55 schrieb Rick Curtis: Yes that seems reasonable. I'll get that taken care of sometime this afternoon. I'd like to get another JIRA opened up to investigate the JAXB packageElements problem Thanks, Rick On Wed, Mar 23, 2011 at 10:51 AM, Marc Logemann l...@logemann.org wrote: For the time being, how about the following fix in openjpa trunk: /** * The entry point for java compiler. */ @Override public boolean process(Set? extends TypeElement annos, RoundEnvironment roundEnv) { if (active !roundEnv.processingOver()) { Set? extends Element elements = roundEnv.getRootElements(); for (Element e : elements) { if (e instanceof TypeElement) process((TypeElement) e); } } return true; } We simply ignore PackageElement, ExecutableElement, TypeParameterElement and VariableElement. (These are the other Subinterfaces of Element) With this we dont get into trouble and we have time to elaborate on the real problem. roundEnv.getRootElements() simply can return also PackageElements. Why this is only the case for this package with JAXB file is something which one need to research. Thats definitely something in the javax.annotation.processing area of the JDK. But there must be a reason that getRootElements() returns Element and not TypeElement ;-) --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 23.03.2011 um 16:41 schrieb Rick Curtis: still a bit clueless Me too. I just started digging into some of the annotation processor code to see if I can learn something today So when you swallowed the exception everything worked fine? Thanks, Rick
Transient One to One
Hello there, I have a persisted field that contains the PK of another entity. It is not mapped properly and is filled manually. The objects this PK refers to are all loaded elsewhere. The mappedBy seems to only apply to inverse relations. Is there a way I can add a Transient OneToOne field that uses this PK and points to that entity? (It need not be saved again...) How can I add a new field to this same object that refers to the entity pointed to by the PK? I know I am approaching this the wrong way, can anyone provide any guidance on where to go from here? Thank-you. This message may contain confidential and privileged information and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorised. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator and then immediately delete this message. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses. Please refer to http://www.bnymellon.com/disclaimer/piml.html for certain disclosures.
Re: Transient One to One
Maybe I'm just being dense this afternoon, but I'm not following what PK relationships you are trying to map. Can you provide any type of pictures, even cryptic stick diagrams would help. And, exactly is your goal? Thanks. Kevin On Wed, Mar 23, 2011 at 6:41 AM, sam.squ...@paretopartners.com wrote: Hello there, I have a persisted field that contains the PK of another entity. It is not mapped properly and is filled manually. The objects this PK refers to are all loaded elsewhere. The mappedBy seems to only apply to inverse relations. Is there a way I can add a Transient OneToOne field that uses this PK and points to that entity? (It need not be saved again...) How can I add a new field to this same object that refers to the entity pointed to by the PK? I know I am approaching this the wrong way, can anyone provide any guidance on where to go from here? Thank-you. This message may contain confidential and privileged information and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorised. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator and then immediately delete this message. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses. Please refer to http://www.bnymellon.com/disclaimer/piml.html for certain disclosures.
Re: OpenJPA Date Proxy serialization problem when using entities with GWT
I don't know much about the benefits of using proxies, but in our particular usage, all proxies should be removed when the entity is detached/serialized. Then we can use entities directly in GWT avoiding DTOs and also with this, client side will not have dependency on OpenJPA at runtime. Regards, Prashant On Wed, Mar 23, 2011 at 9:22 PM, Michael Dick michael.d.d...@gmail.comwrote: I haven't had a chance to look at your example application, but I think we need to make some changes to the way we handle proxies. Currently there's no way to prevent proxies from being inserted. It's not intuitive when they will be inserted, and they can be tough to remove. What I'd propose is to make it work something like this : if openjpa.ProxyManager.TrackChanges == False : # No proxies are inserted. Ever. else : if openjpa.DetachState.DetachedStateField == true: # proxies are inserted when the entity is flushed (or committed) # proxies are not removed when the entity is detached # proxies are not removed when the entity is serialized elif openjpa.DetachState.DetachedStateField == transient : # proxies are inserted when the entity is flushed (or committed) # proxies are not removed when the entity is detached # proxies are removed when the entity is serialized elif openjpa.DetachState.DetachedStateField == false : # proxies are inserted when the entity is flushed (or committed) # proxies are removed when the entity is detached # proxies are removed when the entity is serialized From what I've seen none of these are accurate for trunk, and the related code path is a bit tangled (or I just haven't groked it). For your specific use case, would you want the proxies to ever be inserted? -mike