Here is an OpenJPA 1.2.1 example that demonstrates the OpenJPA replaces
a collection field problem. This may not be technically a bug but it
can be a problem for the unaware user.
This happens with a new persisted object with a collection field that is
initially null. If the null collection
.jar
- Paul
On 4/29/2009 8:56 AM, Craig L Russell wrote:
Hi Paul,
Thanks for following up on this.
On Apr 28, 2009, at 11:19 PM, Paul Copeland wrote:
Here is an OpenJPA 1.2.1 example that demonstrates the OpenJPA
replaces a collection field problem. This may not be technically a
bug but it can
Hi -
I was attempting a too clever scheme to defer adding to a collection
that has not been lazy loaded yet. The code in the isPropertyLoaded()
method below was posted by an expert on this list a while ago. It works
- it returns true if the field has been loaded.
But the problem is that
Hi Chandra -
XA is a standard for distributed transactions and usually refers to
situations where multiple databases are used in a combined transaction.
This is a big subject. You might get a start here -
http://en.wikipedia.org/wiki/X/Open_XA
- Paul
On 4/27/2009 10:03 AM,
:
Right.
So, you're saying that it's not possible to do one batch transaction
with the DB when there are joins involved?
Thanks,
=David
On Thu, 2009-04-23 at 21:06 -0700, Paul Copeland wrote:
It makes sense that it would do a query per primary key (all in a single
transaction
at 13:49 +0900, David Leangen wrote:
Thank you, I'll give that a try.
On Fri, 2009-04-17 at 07:55 -0700, Paul Copeland wrote:
That sounds interesting. You might turn on verbose logging for SQL
operations (openjpa.jdbc.SQL) and see what queries are actually being
executed
On Tue, Apr 21, 2009 at 12:56 PM, Paul Copeland t...@jotobjects.com
wrote:
Can you get it to work without Maven and without Eclipse first? You
should
be able to (1) download OpenJPA 1.2.1, (2) cd to examples/hellojpa,
(3)
type
ant
That should be all you have
Can you get it to work without Maven and without Eclipse first? You
should be able to (1) download OpenJPA 1.2.1, (2) cd to
examples/hellojpa, (3) type ant
That should be all you have to do. If that does not end in BUILD
SUCCESSFUL please send the output to this list.
Once you have that
That sounds interesting. You might turn on verbose logging for SQL
operations (openjpa.jdbc.SQL) and see what queries are actually being
executed. The logging section of the OpenJPA manual explains this.
On 4/17/2009 3:41 AM, David Leangen wrote:
Hello,
I'm not at all an expert in
Hi Adam -
JIRA-39 is pretty old. Possibly JIRA-1004 is related to your question? There
was recent discussion on this list about this.
Also there was recent mention on this list of using either one of these
settings regarding ordering of operations (reading the docs leaves me
with some
Does the test below fail for you? It works correctly for Ravi. Can you
send an example that demonstrates the problem?
On 4/13/2009 8:08 AM, hmmahboobi wrote:
Hi
Thanks for your response,
This model is a small view of our large system,
Actual codes are very large and complex, so I cant send
to the database (even
though persist() has been called) the value could be null rather than an
empty collection. So the behavior of OpenJPA returning null (assertion
#1) would be consistent with the spec.
- Paul
On 4/9/2009 12:22 PM, Paul Copeland wrote:
Thanks for the assistance Craig -
Here
are holding
a reference to the value returned by getMyPcList() that collection will
then be stale, possibly leading to inconsistent results for the caller.
- Paul
(other comments below)
On 4/13/2009 4:18 PM, Craig L Russell wrote:
Hi Paul,
On Apr 13, 2009, at 9:04 AM, Paul Copeland wrote
,
On Apr 13, 2009, at 5:15 PM, Paul Copeland wrote:
Craig - Thanks for the responses. This confirms that for a new Entity
a collection field may be null unless the application initializes it.
When you say flushed does that include calling
EntityManager.flush() before the transaction is committed
unmanaged means the Account object assigned to the ManyToOne field is
new and not yet persistent, removed, or detached.
On 4/11/2009 7:46 AM, rpalache wrote:
Hi,
Set the cascade attribute for this field to CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or
persist or all (JPA
Hi Stefan - I think your A.SetB(B) method must call B.add(A)
From section 2.1.7 in JPA Specification - Note that it is the
application that bears responsibility for maintaining the consistency of
runtime relationships---for example, for insuring that the one and the
many sides of a
metric.
Considering everything, I still recommend that you instantiate an
empty collection when you construct an entity.
Craig
On Apr 8, 2009, at 10:21 AM, Paul Copeland wrote:
Pinaki -
I tried your suggestion of not initializing the value of myPcList and
I get a null pointer exception when
um 20:03 schrieb Paul Copeland:
Marc -
If all the join columns are indexed it should not be too slow. You
could put the same SQL into an explain analysis tool to investigate
it. For a start run the SQL outside JPA and see how many rows are
returned.
Notice you are getting an orderpos
to the collection).
If the experts believe either of these assertions are incorrect then I
definitely want to investigate further.
- Paul
(further comments below)
On 4/9/2009 11:13 AM, Craig L Russell wrote:
Hi Paul,
On Apr 9, 2009, at 9:40 AM, Paul Copeland wrote:
Couple of clarifications
Can OpenJPA replace a Collection when it is loaded?
With the code below when the list is initially empty you need to create
a List (ArrayList) so you can add elements to it. When I persisted new
objects on the ManyToOne side and added them to the List that worked.
But the first time the List
(java.util.ArrayList.class, list.getClass());
list.add(new MyPcObject());
owner.setMyPcList(list);
On Apr 7, 2009, at 11:10 PM, Paul Copeland wrote:
Can OpenJPA replace a Collection when it is loaded?
With the code below when the list is initially empty you need to
create a List (ArrayList
.
- Paul
On 4/8/2009 9:43 AM, Paul Copeland wrote:
Thanks Pinaki -
I think you are saying that at some point the proxy object does
replace the local List. Is that right?
I have seen that model - if (myPcList == null) myPcList = new
ArrayList() - in various examples (not sure where now). Thanks
gr.
---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de
Am 08.04.2009 um 06:49 schrieb Paul Copeland:
Hi Marc -
I wonder what kind of database schema that produces. Normally you
would have OneToMany on one side and ManyToOne on the other side,
with the mappedBy
Thanks for the feedback.
Judes suggestion looks promising for ManyToMany case but could
complicate my forward mapping.
Pinaki - Your suggestion sort of works ... because it creates a new
unmodifiableList every time getMyPcList() is called -- there is a constructor
invoked inside
to define the classes you want to map. I am
using the classes listed in persistence.xml which is why I need to
specify a persistence-unit on the command line.
- Pau|l|
On 4/7/2009 7:16 AM, Edoardo Panfili wrote:
Il 6-04-2009 18:14, Paul Copeland ha scritto:
Hello Edoardo -
I got this to work
I am trying to provide JPA persistent objects in a framework. If I
return a ManyToMany Collection the user has to understand what side is
the mappedBy owner and be careful to update both sides. There are other
reasons for wanting to restrict updates to OneToMany relations. Is
there a way to
Is there a workaround for 1.2.1?
I'm also hitting the reentrant flush exception with GenerationType.IDENTITY
On 3/30/2009 10:26 AM, Nemanja Joksovic wrote:
Thanks Fay,
I tried it before and it's working fine. But in production environment I need
to using stable OpenJPA 1.2.x version (JPA
are.
I already tried doing flushes. Maybe I need to do a refresh too?
- Paul
On 4/7/2009 1:51 PM, Fay Wang wrote:
The fix is in JIRA-1004. I only checked in the fix to trunk, not 1.2.x, though.
-Fay
- Original Message
From: Paul Copeland t...@jotobjects.com
To: users
Hi Marc -
I wonder what kind of database schema that produces. Normally you would
have OneToMany on one side and ManyToOne on the other side, with the
mappedBy on the OneToMany side. This is the classical way the foreign
keys work in relational database models. I think you do not need
Are there other forums or lists that are good for asking general JPA
questions (not specifically OpenJPA)?
- Paul
Hello Edoardo -
I got this to work with Ant and OpenJPA 1.2.1 similar to what you are
doing with schemaAction=build and sqlFile=abc.sql (without action
element).
However I gave up on the taskdef when I found that I could not specify
java arguments and sysproperty values to the Ant task. I
There seems to a minor confusion in the 1.2.1 OpenJPA manual regarding
openjpa.jdbc.MappingDefaults
Section 7.4 Reference Guide - I discovered by trial and error that the
jpa alias is the default and the default alias is NOT the default.
Using the jpa alias generates the same forward mapping
specification. The
cascade=REMOVE specification should only be applied to associations that
are specified as One-
ToOne or OneToMany. Applications that apply cascade=REMOVE to other
associations are not portable.
On 4/3/2009 10:43 AM, Paul Copeland wrote:
Will CascadeType.REMOVE on a ManyToMany mapping
Looks like I can use the OpenJPA @ForeignKey annotation
deleteAction=CASCADE - will give it a try.
On 4/3/2009 11:18 AM, Paul Copeland wrote:
This is from the JPA spec - Sounds like cascade=REMOVE should not be
used on ManyToMany. However I'm recalling that some databases do
provide DDL
inconsistent..
I made the following changes to the mapping..
@ManyToOne (optional=false, CascadeType.ALL)
Is this a defect?
Best regards,
Srini
On Wed, Apr 1, 2009 at 11:20 PM, Paul Copeland (via Nabble)
wrote:
Does it make any difference if you put the CascadeType.ALL on both sides?
Does
Hi Ted -
Just to clarify, have you tried this with FetchType.EAGER and with no
FetchType specified and in those cases the problem does not happen?
A more general observation is that the semantics of this OpenJPA
@PersistentCollection extension do not seem to be fully specified (is
there a
generally suffice for
catching modifications.
On Thu, Apr 02, 2009 at 07:26:38AM -0700, Paul Copeland wrote:
Hi Ted -
Just to clarify, have you tried this with FetchType.EAGER and with no
FetchType specified and in those cases the problem does not happen?
A more general observation
Is there a way to tell if a lazily fetched Collection is already loaded
without accessing the field and forcing it to load? I want to add a new
persistent entity to a Collection, but only if the Collection has
already been fetched - because fetching a large collection may be
expensive. But
Does it make any difference if you put the CascadeType.ALL on both sides?
Does it make any difference if you put optional=false on the ManyToOne ?
@ManyToOne (optional=false, CascadeType.ALL)
On 4/1/2009 10:29 AM, srini.krish wrote:
Hi ,
I am trying to create a bidirectional one to many
a very straight forward use case
though so I'm surprised no one has asked or done anything about this
before.
On Sat, Mar 28, 2009 at 10:13:16PM -0700, Paul Copeland wrote:
What is your objective? Do you want some non-JPA application to
see them in the database as Strings
Here is a naive question about a OneToMany relationship. This is
probably a basic question.
I have a lazily fetched List. It might be large and I don't want to
load it until it is accessed.
In a transaction - If I create and persist a new Entity that is a member
of the list, I think (is
Hi - This is from the OpenJPA relations example -
@Basic @Enumerated(EnumType.STRING)
private Gender gender;
public static enum Gender { MALE, FEMALE }
public void setGender(Gender gender) {
this.gender = gender;
}
See section 12.8.1.2 in the OpenJPA Overview
- Paul
On
it belongs
to. This persist action should not load its master's members list.
Catalina
On Sat, Mar 28, 2009 at 12:06 PM, Paul Copeland t...@jotobjects.com wrote:
Here is a naive question about a OneToMany relationship. This is probably
a basic question.
I have a lazily fetched List. It might
not force the lazily fetched fields to be
loaded. What is the behavior?
- Paul
On 3/28/2009 2:25 PM, Paul Copeland wrote:
Hi Catalina -
All of what you said confirms my understanding.
One question I have is will a new Persistent member that has not been
flushed in the same transaction be returned
Your alternatives depend on the database you are using. What database?
On 3/28/2009 6:24 PM, 乔木 wrote:
I don't want openjpa to create that table
value both for table generation and storage value.
On Sat, Mar 28, 2009 at 01:56:13PM -0700, Paul Copeland wrote:
Hi - This is from the OpenJPA relations example -
@Basic @Enumerated(EnumType.STRING)
private Gender gender;
public static enum Gender { MALE, FEMALE }
public void
app and I'll take a look at it.
brbr-Rick
brblockquote class=quote light-black dark-border-colordiv class=quote
light-border-color
div class=quote-author style=font-weight: bold;Paul Copeland wrote:/div
div class=quote-message shrinkable-quoteHi Rick -
brbrThanks. As I mentioned the openjpa
Hi Edoardo -
This is a bit off the topic of your question, but I am interested in
your pattern for setting the EntityManager in a filter. That seems like
a reasonable thing to do. I wonder if other servlet developers on the
list do it any other way?
One question I have for you is that
Mike - Thanks for all the great work on this. The link below is for the
older 1.2.0 release. Here is the link for the NEW 1.2.1 release notes -
http://openjpa.apache.org/builds/1.2.1/apache-openjpa-1.2.1/RELEASE-NOTES.html
On 3/23/2009 6:10 PM, Michael Dick wrote:
OpenJPA 1.2.1 is now
On Tue, Mar 24, 2009 at 10:00 AM, Paul Copeland t...@jotobjects.com wrote:
Mike - Thanks for all the great work on this. The link below is for the
older 1.2.0 release. Here is the link for the NEW 1.2.1 release notes -
http://openjpa.apache.org/builds/1.2.1/apache-openjpa-1.2.1/RELEASE
specific
to your environment.? I was able to run the examples on my box without
adding xercesImpl.jar to my classpath. With my JSE1.6 install,
SAXParserFactoryImpl is found in the [java_home]\lib\rt.jar.
-Rick
Paul Copeland wrote:
More info on this. I upgraded to Java SE 1.6.0_12 and I still need
correction to prior message - my very simple test app does not work
without xerces.
On 3/23/2009 10:25 AM, Paul Copeland wrote:
Hi Rick -
Thanks. As I mentioned the openjpa example hellojpa also works for me
WITHOUT the xerces jar. But my very simple test app does not work
with xerces
with earlier versions, I just grabbed the latest from the maven
repository).
-mike
On Fri, Mar 20, 2009 at 10:26 AM, Paul Copeland t...@jotobjects.com wrote:
Interesting. Does this Jira bug say that OpenJPA applications can compile
and run with Java 1.6 as long as they do not use JDBC 4
it on the
others (too many lines to highlight accurately.
I'm still looking, but thought this was worth sharing in case someone
else
sees something I've missed.
-mike
On Thu, Mar 19, 2009 at 10:53 AM, Paul Copeland t...@jotobjects.com
wrote:
At one point in this thread it was mentioned
highlighted the changed lines in WarehouseDAO, but missed it on the
others (too many lines to highlight accurately.
I'm still looking, but thought this was worth sharing in case someone else
sees something I've missed.
-mike
On Thu, Mar 19, 2009 at 10:53 AM, Paul Copeland t...@jotobjects.comwrote
=jdbc:postgresql://localhost:5432/myDBname/
property name=openjpa.ConnectionUserName value=x/
property name=openjpa.ConnectionPassword value=xx/
!-- END PROPERTIES FOR OpenJPA --
Judes
On Tue, Mar 17, 2009 at 9:27 AM, Paul Copeland t...@jotobjects.com wrote:
Thanks
Which version of OpenJPA are you using?
On 3/19/2009 4:06 AM, d...@sparnord.dk wrote:
Hi,
I'm getting this exception:
org.apache.openjpa.persistence.PersistenceException: null
at
org.apache.openjpa.jdbc.meta.FieldMapping.assertStrategy(FieldMapping.java:888)
#a1449832
[2]
http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html
[3]
http://webspherepersistence.blogspot.com/2009/01/jpa-connection-pooling.html
hth,
-Jeremy
On Thu, Mar 19, 2009 at 2:33 PM, Paul Copeland t...@jotobjects.com wrote:
I am just getting
for Postgres 8.2x and 8.3x since the openJPA manual
only mentions support for Postgres 8.1.5. Is there a sure way to answer
that question?
- Paul
|
On 3/16/2009 7:07 PM, Judes Tumuhairwe wrote:
I'm using Postgres 8.2 with no problems.
Judes
On Mon, Mar 16, 2009 at 5:16 PM, Paul Copeland t
What is different abut your laptop at home vs. multiple computers at
work? Are they all connected to the same network?
On 3/17/2009 11:30 AM, Shubbis wrote:
Ok, I still dont know what the problem is, but it seems like its not
OpenJPA's fault (i think).
I just took the whole project home with
Of course java.util.Date is already measured in milliseconds UTC without
regard to TimeZone. So it may seem that you are converting your Date
objects to a different timezone, but that's not the case. This is why
you can use Calendar.compareTo() with objects in different TimeZones.
By
time zone, the timestamp value in the database is
2009-03-17-16.23.27.494000. Let me try a simple
POJO test case to see if this is an openjpa problem or not.
--- On Tue, 3/17/09, Paul Copeland
t...@jotobjects.com wrote:
From: Paul Copeland t...@jotobjects.com
Subject: Re: How do I
I would like to use Postgres 8.2 (latest 8.2 minor version is 8.2.13).
The openJPA manual lists Postgres 8.1.5 as a supported database in
Appendix 2.
The openJPA reference guide section 4 Database Support says OpenJPA can
take advantage of any JDBC 2.x compliant driver and then points to the
63 matches
Mail list logo