Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Rick Curtis
> I have heard it said that "programmatic javac compiler for debugging"
means that you have a junit testcase which calls com.sun.tools.javac.Main.

I heard it somehow involved a chicken and some sort of voodoo dance. :)

On Thu, Mar 24, 2011 at 11:27 AM, Michael Dick wrote:

> On Thu, Mar 24, 2011 at 10:40 AM, Marc Logemann  wrote:
>
> > >
> > >> you are late.
> > > Not really. The code was written two years ago, with a programmatic
> javac
> > > compiler for debugging ;)
> >
> >
> > thats not what i meant. I meant in following our discussion on the list
> ;-)
> > When i am old and skilled i will check again what you mean with
> > "programmatic javac compiler for debugging" :-) until that time point, i
> > continue doing this poor "implement a copy/pasted processor and write
> some
> > println statements in there" (c) hrhr.
> >
>
> I have heard it said that "programmatic javac compiler for debugging" means
> that you have a junit testcase which calls com.sun.tools.javac.Main. That
> way you can debug your junit (or your own main method) and step into the
> compilation process.
>
> -mike
>


JPQL delete with subquery

2011-03-24 Thread LongkerDandy
Hi

I can't figure out this.
I want to delete all the MOVIE entities which doesn't contain any files.

entityManager.createQuery("DELETE FROM MOVIE m WHERE m IN (SELECT em FROM
MOVIE em LEFT JOIN em.files f WHERE em.files IS NULL)").executeUpdate();

And I got the exception:

(
org.apache.openjpa.persistence.ArgumentException: "Encountered "m IN" at
character 27, but expected: ["(", "*", "+", "-", ".", "/", ":", "<", "<=",
"<>", "=", ">", ">=", "?", "ABS", "ALL", "AND", "ANY", "AS", "ASC", "AVG",
"BETWEEN", "BOTH", "BY", "CONCAT", "COUNT", "CURRENT_DATE", "CURRENT_TIME",
"CURRENT_TIMESTAMP", "DELETE", "DESC", "DISTINCT", "EMPTY", "ESCAPE",
"EXISTS", "FETCH", "FROM", "GROUP", "HAVING", "IN", "INDEX", "INNER", "IS",
"JOIN", "KEY", "LEADING", "LEFT", "LENGTH", "LIKE", "LOCATE", "LOWER",
"MAX", "MEMBER", "MIN", "MOD", "NEW", "NOT", "NULL", "OBJECT", "OF", "OR",
"ORDER", "OUTER", "SELECT", "SET", "SIZE", "SOME", "SQRT", "SUBSTRING",
"SUM", "TRAILING", "TRIM", "TYPE", "UPDATE", "UPPER", "VALUE", "WHERE",
, , , ,
, , , ]."
while parsing JPQL "DELETE FROM MOVIE m WHERE m IN (SELECT em FROM MOVIE em
LEFT JOIN em.files f WHERE em.files IS NULL)".


Any hint?Thanks
LongkerDandy


Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Marc Logemann

Am 24.03.2011 um 17:27 schrieb Michael Dick:

> On Thu, Mar 24, 2011 at 10:40 AM, Marc Logemann  wrote:
> 
>>> 
 you are late.
>>> Not really. The code was written two years ago, with a programmatic javac
>>> compiler for debugging ;)
>> 
>> 
>> thats not what i meant. I meant in following our discussion on the list ;-)
>> When i am old and skilled i will check again what you mean with
>> "programmatic javac compiler for debugging" :-) until that time point, i
>> continue doing this poor "implement a copy/pasted processor and write some
>> println statements in there" (c) hrhr.
>> 
> 
> I have heard it said that "programmatic javac compiler for debugging" means
> that you have a junit testcase which calls com.sun.tools.javac.Main. That
> way you can debug your junit (or your own main method) and step into the
> compilation process.
> 
> -mike

ahh now i get it. This sounds smart. To be honest, i never ever dealt with 
com.sun.tools.javac.Main directly during my 8 years of java development ;-)

My way was also quite nice because now i have my own AnnotationProcessor 
variant, which will stay active until you guys fix the one in the 2.1.x 
release... or i can use Ricks patched jar of course.

Marc

Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Michael Dick
On Thu, Mar 24, 2011 at 10:40 AM, Marc Logemann  wrote:

> >
> >> you are late.
> > Not really. The code was written two years ago, with a programmatic javac
> > compiler for debugging ;)
>
>
> thats not what i meant. I meant in following our discussion on the list ;-)
> When i am old and skilled i will check again what you mean with
> "programmatic javac compiler for debugging" :-) until that time point, i
> continue doing this poor "implement a copy/pasted processor and write some
> println statements in there" (c) hrhr.
>

I have heard it said that "programmatic javac compiler for debugging" means
that you have a junit testcase which calls com.sun.tools.javac.Main. That
way you can debug your junit (or your own main method) and step into the
compilation process.

-mike


Re: How to enable schema log ?

2011-03-24 Thread Michael Dick
I think this will work


I suspect it's case sensitive but haven't tried it out.

-mike

On Thu, Mar 24, 2011 at 10:55 AM, Jean-Baptiste BRIAUD -- Novlog <
j-b.bri...@novlog.com> wrote:

> Hi,
>
> I got this in an error message :
> Enable the org.apache.openjpa.jdbc.Schema logging category to see messages
> about schema data.
>
> I can't find what to add in the persistence.xml if it is there something
> should be added...
>
> I already added the following line but I feel it is something else :
> 
>
> Is it linked ?
>
> How to enable that schema logging ?
>
> Thanks !
>
>


How to enable schema log ?

2011-03-24 Thread Jean-Baptiste BRIAUD -- Novlog
Hi,

I got this in an error message :
Enable the org.apache.openjpa.jdbc.Schema logging category to see messages 
about schema data.

I can't find what to add in the persistence.xml if it is there something should 
be added...

I already added the following line but I feel it is something else :


Is it linked ?

How to enable that schema logging ?

Thanks !



Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Marc Logemann
> 
>> you are late. 
> Not really. The code was written two years ago, with a programmatic javac
> compiler for debugging ;)


thats not what i meant. I meant in following our discussion on the list ;-) 
When i am old and skilled i will check again what you mean with "programmatic 
javac compiler for debugging" :-) until that time point, i continue doing this 
poor "implement a copy/pasted processor and write some println statements in 
there" (c) hrhr.

Marc



Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Pinaki Poddar
> We basically figured out all the issues.
I am sure you did. Good luck :)

> you are late. 
Not really. The code was written two years ago, with a programmatic javac
compiler for debugging ;)

-
Pinaki 
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/MetaModel-creation-with-Aopenjpa-generate-true-tp6200077p6204525.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Marc Logemann
you are late. We basically figured out all the issues. I also presented a fix 
and Rick supplied a patched jar and hopefully this fix will make it into the 
next 2.1 release.

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 24.03.2011 um 14:25 schrieb Pinaki Poddar:

>> Debugging is also not that easy within an ANT process. Perhaps someone give
> me an hint how to proceed.
> 
> Invoke javac compiler programmatically. Pass "opejpa.metamodel" in compiler
> argument. 
> You will require tools.jar in your classpath. 
> 
> -
> Pinaki 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/MetaModel-creation-with-Aopenjpa-generate-true-tp6200077p6204075.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Marc Logemann
Hi,

i am quite sure that there were a lot more jars when i had the single ALL 
dependency in my ivy setup. 
Dont have the time to prove right now. In fact one dont need the service file 
when using the -processor flag in javac.

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 24.03.2011 um 14:00 schrieb Pinaki Poddar:

> Hi,
>  The annotation processing requires dependency on openjpa-all jar. Can you
> please explain why you declared dependencies to individual module jars but
> not the consolidated openjpa jar? 
> 
>> I dont want to inlcude "openjpa" as a whole because i want to leave
> out unneeded clutter. 
>But it seemed to be OK to include 3/4 individual openjpa*.jar -- that
> looks more cluttered to me.
> 
> Anyway, our service file packaging will not cope with the individual
> jar dependencies as you have described. You need to have a single openjpa
> jar in your classpath
> 
>  To generate canonical metamodel classes using OpenJPA has two
> pre-requisites
>   1. compiler classpath must have consolidated openjpa jar
>   2. Compiler argument -Aopenjpa.metamodel=true must be set 
> 
> 
> 
> 
> -
> Pinaki 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/MetaModel-creation-with-Aopenjpa-generate-true-tp6200077p6203998.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Pinaki Poddar
> Debugging is also not that easy within an ANT process. Perhaps someone give
me an hint how to proceed.

Invoke javac compiler programmatically. Pass "opejpa.metamodel" in compiler
argument. 
You will require tools.jar in your classpath. 

-
Pinaki 
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/MetaModel-creation-with-Aopenjpa-generate-true-tp6200077p6204075.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Transient One to One

2011-03-24 Thread Matthew Adams
I think what you want to do is have two fields in your referencing
object:  one persistent field to hold the PK to the other object, and
one transient field to hold a reference to the object that has the PK.
 Then, in a post-load callback, populate the transient reference using
the field containing the PK of the object you want to reference
transiently.  You could also nullify the transient field on a
pre-detach & pre-delete as well.

public class Foo {
  // ...
  private BarKey barKey; // persistent, stores PK
  @Transient
  private Bar bar; // transient, refers to Bar with key barKey
  @PostLoad
  public void postLoad() {
bar = goFindBarByKey(barKey); // or however you load the Bar
  }
}

-matthew

On Wed, Mar 23, 2011 at 6:41 AM,   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.



-- 
mailto:matt...@matthewadams.me
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:matthewadam...@gmail.com
msn:matt...@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams


Re: OpenJPA Date Proxy serialization problem when using entities with GWT

2011-03-24 Thread Pinaki Poddar
Hi Prashant,
  You may like to check out a complete GWT + OpenJPA sample in
openjpa-examples/opentrader directory.

 

-
Pinaki 
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-Date-Proxy-serialization-problem-when-using-entities-with-GWT-tp6156425p6204055.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Pinaki Poddar
Hi,
  The annotation processing requires dependency on openjpa-all jar. Can you
please explain why you declared dependencies to individual module jars but
not the consolidated openjpa jar? 

> I dont want to inlcude "openjpa" as a whole because i want to leave
out unneeded clutter. 
But it seemed to be OK to include 3/4 individual openjpa*.jar -- that
looks more cluttered to me.
 
 Anyway, our service file packaging will not cope with the individual
jar dependencies as you have described. You need to have a single openjpa
jar in your classpath

  To generate canonical metamodel classes using OpenJPA has two
pre-requisites
   1. compiler classpath must have consolidated openjpa jar
   2. Compiler argument -Aopenjpa.metamodel=true must be set 


  

-
Pinaki 
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/MetaModel-creation-with-Aopenjpa-generate-true-tp6200077p6203998.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: MetaModel creation with -Aopenjpa.generate=true

2011-03-24 Thread Marc Logemann
Hi,

this is nearly impossible because its not an Entity which makes the problem 
here. Its a package. I have no idea how to unit test that. Perhaps you can try 
creating 
a simple package with JAXB generated classes in it and try to reproduce:

1) create a very simple XSD file
2) run the JAXB compiler via ANT (then you should have some classes in 
myweirdpackage)





  

3) put at least one Entity in domain package (parent of myweirdpackage)
4) run the MetaModel compiling step

Does this help?

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 23.03.2011 um 20:45 schrieb Rick Curtis:

> 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  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  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 
>> wrote:
> 
>> For the time being, how about the following fix in openjpa trunk:
>> 
>> /**
>>  * The entry point for java compiler.
>>  */
>>  @Override
>> public boolean process(Set annos,
>> RoundEnvironment roundEnv) {
>> if (active && !roundEnv.processingOver()) {
>> Set 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