Re: Persist issue in multithreaded environment

2009-08-07 Thread Jean-Baptiste BRIAUD -- Novlog

did you had a look on that method on the EntityManager :
setMultithreaded(boolean multi)
  Whether the entity manager or its managed instances are  
used in a multithreaded environment.


It sound like EntityManager has to know wheter or not it is used with  
threads.

Probably the equivalent of the properties you first talked about.

Hope this helps.

Delete or merge, update or merge ?

2009-08-07 Thread Jean-Baptiste BRIAUD -- Novlog

Hi,

say I have one instance to delete, an instance of B knowing that A  
contains one to many B.


Should I merge A with one less B, that should delete the required B or  
should I explicitly delete that B with a delete by query or should I  
use the remove(thatB) API ?

What are the differences in term of design, memory, performance, ... ?

Quedtion also apply in case of a new B : merge on A, insert by query  
or persist(thatB) on entityManager ?


The same question apply to merge or update by query one B.

Thanks !


Re: Problem with data cache, inverse relation, maybe parallel eager results

2009-08-07 Thread David Minor
OK, I think I've figured out the general idea of what's going on:

1. Multiple Entity A's are requested (say A1, A2). The JDBCStoreManager
starts processing in parallel eager mode.
2. During the processing of A1, all Entity B's are processed in parallel
eager mode.
3. An Entity B belonging to A2 is found in the cache (say B2).
4. The cache has no knowledge of eager results, inverse relations, etc., and
loads *all* fields of B2.
5. B2 loads A2.
6. A2 loads all of its Entity B's. At this point the Entity B's
StateManager.isLoading() returns true and breaks the recursion.
7. SetInverseRelation() doesn't get applied to at least one of A2's entity
B, not sure why -- maybe because the Entity B was loaded in step 2?
8. After processing A1 has finished, BrokerImpl finds A2's StateManager in
its cache, so setInverseRelation() doesn't get called here either.

I found that if I changed the class structure a bit so that
DataCacheStoreManager is aware of the mapped by field in the current result,
and calls an implementation of setMappedBy() rather than loading that
particular field, then the problem went away.


On Thu, Aug 6, 2009 at 11:46 AM, David Minor  wrote:

> I have an entity A with a to-many relation to entity B. If entity A is
> retrieved from the database, and entity B is found in the cache, the inverse
> field from entity B to entity A is null.
>
> StoreCollectionFieldStrategy.processEagerParallelResult() is setting a
> "mapped by" field in the result object to entity A's object ID, however the
> DataCacheStoreManager seems to not be aware of this and is trying to load
> the inverse field in entity B, whereas the JDBCStoreManager has
> setMappedBy().
>
> DataCacheStoreManager appears to be attempting to load entity A all over
> again, and subsequently entity B again, but there's so much delegation and
> caching it's hard to tell.
>
> This problem goes away if I revert the changes from
> http://issues.apache.org/jira/browse/OPENJPA-744
>
> If I change EagerFetchMode to "join" it seems to become rarer, but still
> occurs.
>
> I'm using 1.2.1.
>
> Any ideas?
>
> --
> _
> David Minor
>



-- 
_
David Minor


Re: ClassStrategy.

2009-08-07 Thread Jeremy Bauer
Hi Chris,

As you dive into creating custom strategies, besides reading the OpenJPA
docs, you may also want to check out this blog post[1] on the topic.

-Jeremy

[1]
http://webspherepersistence.blogspot.com/2009/04/custom-orm-with-openjpa.html

On Fri, Aug 7, 2009 at 2:43 AM, C N Davies  wrote:

>
>
> Looking at the docs there should be an interface named
> org.apache.openjpa.jdbc.meta.ClassStrategy  which needs to be implemented
> in
> order to implement a strategy for a custom class. But I cannot find the
> class in any of the OpenJPA 1.2.1 jars.  Is the document wrong or am I just
> stupid?
>
>
>
> Thanks J
>
>
>
> Chris
>
>
>
>


Re: ClassStrategy.

2009-08-07 Thread Rick Curtis
Donald -

The subdir openjpa-all/.

-Rick

On Fri, Aug 7, 2009 at 10:37 AM, Donald Woods  wrote:

> Rick, did you mean you built the openjpa-all subdir or a jar named that?
>
> The openjpa-all.jar is only created by the 1.3.x and trunk builds.
> The 1.2.x/openjpa-all/pom.xml generates the openjpa-1.2.x.jar file.
>
>
> -Donald
>
>
>
> Rick Curtis wrote:
>
>> Chris -
>>
>> I built my 1.2.x workspace and found it in the openjpa-all jar. I also
>> checked in the binary download from the openjpa website and the class was
>> there also.
>>
>> /org/apache/openjpa/jdbc/meta/ClassStrategy.class
>>
>> -Rick
>>
>> On Fri, Aug 7, 2009 at 2:43 AM, C N Davies  wrote:
>>
>>
>>> Looking at the docs there should be an interface named
>>> org.apache.openjpa.jdbc.meta.ClassStrategy  which needs to be implemented
>>> in
>>> order to implement a strategy for a custom class. But I cannot find the
>>> class in any of the OpenJPA 1.2.1 jars.  Is the document wrong or am I
>>> just
>>> stupid?
>>>
>>>
>>>
>>> Thanks J
>>>
>>>
>>>
>>> Chris
>>>
>>>
>>>
>>>
>>>
>>


Re: ClassStrategy.

2009-08-07 Thread Donald Woods

Rick, did you mean you built the openjpa-all subdir or a jar named that?

The openjpa-all.jar is only created by the 1.3.x and trunk builds.
The 1.2.x/openjpa-all/pom.xml generates the openjpa-1.2.x.jar file.


-Donald


Rick Curtis wrote:

Chris -

I built my 1.2.x workspace and found it in the openjpa-all jar. I also
checked in the binary download from the openjpa website and the class was
there also.

/org/apache/openjpa/jdbc/meta/ClassStrategy.class

-Rick

On Fri, Aug 7, 2009 at 2:43 AM, C N Davies  wrote:



Looking at the docs there should be an interface named
org.apache.openjpa.jdbc.meta.ClassStrategy  which needs to be implemented
in
order to implement a strategy for a custom class. But I cannot find the
class in any of the OpenJPA 1.2.1 jars.  Is the document wrong or am I just
stupid?



Thanks J



Chris








Re: overriding accesors in entity needs tranisent declaration

2009-08-07 Thread pdd

Interestingly, Hibernate has similar behavior but little better in the sense
that it at least calls the overridden accessors. 
https://forum.hibernate.org/viewtopic.php?f=1&t=998837

Can this be fixed?
-- 
View this message in context: 
http://n2.nabble.com/overriding-accesors-in-entity-need-tranisent-declaration-tp3363414p3404818.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


RE: ClassStrategy.

2009-08-07 Thread C N Davies
Thanks Rick,  

 

I don't have that jar, I only have openjpa-1.2.1.jar and also the lib and
examples directories. I checked my original downloaded binary zip file and I
can't see the jar file there either. H ..  puzzling.

 

Anyway Thanks Rick,  I will download the stuff again

 

Chris

 

 

From: Rick Curtis [mailto:curti...@gmail.com] 
Sent: Friday, 7 August 2009 11:12 PM
To: users@openjpa.apache.org; c...@cndavies.com
Subject: Re: ClassStrategy.

 

Chris -

I built my 1.2.x workspace and found it in the openjpa-all jar. I also
checked in the binary download from the openjpa website and the class was
there also.

/org/apache/openjpa/jdbc/meta/ClassStrategy.class

-Rick

On Fri, Aug 7, 2009 at 2:43 AM, C N Davies  wrote:



Looking at the docs there should be an interface named
org.apache.openjpa.jdbc.meta.ClassStrategy  which needs to be implemented in
order to implement a strategy for a custom class. But I cannot find the
class in any of the OpenJPA 1.2.1 jars.  Is the document wrong or am I just
stupid?



Thanks J



Chris




 



Re: How to encrypt DB password in persistence.xml

2009-08-07 Thread Michael Dick
Hi Yu,

At the moment our support allows you to specify an 'Encryption Provider'
which handles the encryption / decryption of a password. We aren't providing
a tool to do the actual encryption - just a plugin point for other tools.

It sounds like you have written the encryption code in your extension for
DBCP so it should be fairly easy to wrap in an encryption provider.

Hope this helps,
-mike

On Fri, Aug 7, 2009 at 1:25 AM, wang yu  wrote:

> Rick,
> Thank you for your information. I have resolved this issue by
> modifying dbcp source code.
> The bad part is dbcp can be built with jdk 1.4 only which made build
> system little bit complicated:-)
>
> If you can deliver encryption feature in next release, I'll be very
> pleased to use it.
>
> Regards,
> Yu Wang
>
>
> On Fri, Aug 7, 2009 at 5:22 AM, Rick Curtis wrote:
> >
> > Yu Wang -
> >
> > OPENJPA-1089[1] wasn't your exact problem, but I want you to be aware
> that a
> > change was made.
> >
> > Thanks -
> > Rick
> >
> > [1] https://issues.apache.org/jira/browse/OPENJPA-1089
> > --
> > View this message in context:
> http://n2.nabble.com/How-to-encrypt-DB-password-in-persistence.xml-tp2868212p3400811.html
> > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >
>


Re: ClassStrategy.

2009-08-07 Thread Rick Curtis
Chris -

I built my 1.2.x workspace and found it in the openjpa-all jar. I also
checked in the binary download from the openjpa website and the class was
there also.

/org/apache/openjpa/jdbc/meta/ClassStrategy.class

-Rick

On Fri, Aug 7, 2009 at 2:43 AM, C N Davies  wrote:

>
>
> Looking at the docs there should be an interface named
> org.apache.openjpa.jdbc.meta.ClassStrategy  which needs to be implemented
> in
> order to implement a strategy for a custom class. But I cannot find the
> class in any of the OpenJPA 1.2.1 jars.  Is the document wrong or am I just
> stupid?
>
>
>
> Thanks J
>
>
>
> Chris
>
>
>
>


ClassStrategy.

2009-08-07 Thread C N Davies
 

Looking at the docs there should be an interface named
org.apache.openjpa.jdbc.meta.ClassStrategy  which needs to be implemented in
order to implement a strategy for a custom class. But I cannot find the
class in any of the OpenJPA 1.2.1 jars.  Is the document wrong or am I just
stupid?

 

Thanks J

 

Chris