PCEnhancer / PCEnhancerTask should take in class path

2011-12-26 Thread Pawel Veselov
Hi. after bashing my head for awhile against the PCEnhancer, it looks like it really needs a way to take in the class path where to work with entities instead of relying on current class path. The problem is with a simple task: target name=openjpa.enhance taskdef name=openjpac

can I actually not have to list my entities in the persistence.xml?

2011-12-26 Thread Pawel Veselov
Hi. I'm trying to have OpenJPA run with my J2EE app. I don't want to have to list all of the involved classes in my persistence.xml I have run the enhancer on all the entity objects as part of compiling things over. If I use this persistence.xml: ?xml version=1.0 encoding=UTF-8? persistence

Lazy many-to-many properties don't load on demand? (2.1.1)

2011-12-27 Thread Pawel Veselov
Hi. I'm using 2.2.1 I have declared a ManyToMany property, with lazy fetch type (my entities are all property based). The property does not load when accessed (the collection is null). Setting it to eager loading works, but I don't want (for performance reasons) for it to always load. Is there

Re: Lazy many-to-many properties don't load on demand? (2.1.1)

2011-12-27 Thread Pawel Veselov
apps; ... } Mapping in the other direction is also LAZY. Thanks, Pawel. -Ursprüngliche Nachricht- Von: Pawel Veselov [mailto:pawel.vese...@gmail.com] Gesendet: Dienstag, 27. Dezember 2011 12:03 An: users@openjpa.apache.org Betreff: Lazy many-to-many properties don't load

Re: Lazy many-to-many properties don't load on demand? (2.1.1)

2011-12-27 Thread Pawel Veselov
Hi. On Tue, Dec 27, 2011 at 8:42 AM, Pinaki Poddar ppod...@apache.org wrote: @ManyToMany(fetch = FetchType.LAZY, mappedBy = categories) public CollectionE_App apps; change 'public' to 'private' I will try this tonight. Any reason why? I typically access the fields directly, without

Re: Lazy many-to-many properties don't load on demand? (2.1.1)

2011-12-27 Thread Pawel Veselov
PM, Pawel Veselov pawel.vese...@gmail.com wrote: Hi. On Tue, Dec 27, 2011 at 8:42 AM, Pinaki Poddar ppod...@apache.org wrote: @ManyToMany(fetch = FetchType.LAZY, mappedBy = categories) public CollectionE_App apps; change 'public' to 'private' I will try this tonight

Re: Lazy many-to-many properties don't load on demand? (2.1.1)

2011-12-27 Thread Pawel Veselov
Hi Pinaki. On Tue, Dec 27, 2011 at 1:08 PM, Pinaki Poddar ppod...@apache.org wrote: The instance variables of a class must be private, protected, or package visibility independent of whether field access or property access is used. When property access is used, the property accessor methods

left joins, wheres and IN

2011-12-27 Thread Pawel Veselov
Hi. Is there really no way in JPQL to have a left join on a sub-query? It seems that WHERE would always be applied to the product of the join, and never on the joined table. And there doesn't seem to be a way to create a mapped relationship that would be restricted by some sub-query. So the

Re: left joins, wheres and IN

2011-12-28 Thread Pawel Veselov
Hi. On Wed, Dec 28, 2011 at 7:57 AM, Pinaki Poddar ppod...@apache.org wrote: How about select a from Alpha a where {predicates on a} and not exists (select b from Beta b where b.alpha = a and {other predicates on b}) That would of course give the results, but it's a

temporary entity left in the database after being deleted.

2011-12-29 Thread Pawel Veselov
Hi. I'm not sure what I'm doing wrong here. I'm creating a temporary entity, within transaction, deleting the entity before committing. I need that temporary entity in the database during the transaction though... My code is roughly doing this: EntityManager em; // have it E_App temp = new

Re: temporary entity left in the database after being deleted.

2011-12-30 Thread Pawel Veselov
, Pawel Veselov pawel.vese...@gmail.com wrote: Hi. I'm not sure what I'm doing wrong here. I'm creating a temporary entity, within transaction, deleting the entity before committing. I need that temporary entity in the database during the transaction though... My code is roughly doing

changing specific openjpa.jdbc.DBDictionary

2012-01-02 Thread Pawel Veselov
Hi. I'm running OpenJPA (2.1.0) with Derby database. The default dictionary doesn't have value for selecting values from sequences. So, I've added this to my persistence.xml: property name=openjpa.jdbc.DBDictionary value=NextSequenceQuery=quot;SELECT NEXT VALUE FOR {0} from

Re: changing specific openjpa.jdbc.DBDictionary

2012-01-02 Thread Pawel Veselov
On Mon, Jan 2, 2012 at 1:41 PM, Pinaki Poddar ppod...@apache.org wrote: Nope, sorry. For a different database (with a different URL), you will require a different persistence.xml anyway. I disagree. There is nothing in persistence.xml that requires to hardcode the database URL. It's actually

enumerated primary keys

2012-01-16 Thread Pawel Veselov
Hi. I was wondering why enumerations aren't allowed as primary keys? They have to be enumerated as strings or integers, so there isn't much difference between enumeration and a string/integer, except that there is an extra step of picking the right enumeration value at transition... Thanks,

@OneToMany on abstract requires explicit @MapKey

2012-01-22 Thread Pawel Veselov
Hi. I ran into this recently, took me a while before I figured it out. I have a @OneToMany that points to an abstract entity, and is a MapLong, Entity. The entity has Long ID as its primary key. However, OpenJPA apparently is not mapping the key to the primary ID. The tables are managed by the

NULL maps from merged entities

2012-01-24 Thread Pawel Veselov
Hi. Typically, when an entity has a relationship expressed as @OneToMany or @ManyToMany in a form of a collection, or a map, the collection or a map will be empty (not null), if there are no referenced objects (I believe JPA2.0 explicitly states that). So far, I haven't been having any problems

re-attaching detached entities

2012-01-24 Thread Pawel Veselov
Hi. Also not sure if what I'm doing is that despicable. There is an entity, with auto-generated PK. I want to clone this entity into a new one. The entity is also abstract, so the logic behind cloning is somewhat complicated, if done by manually copying each field. So I'm trying to cheat a

Re: EOFException during UUID deserialize

2012-02-28 Thread Pawel Veselov
Hi. You are using special data type UUID in H2 database. You are using Object type in an entity. JPA doesn't have special support for UUID java type. So, it stores it as serialized data, which is in database terms is a binary BLOB. That serialized byte array doesn't quite fit into the UUID

Re: Removal of unnecessary Order By clauses

2012-02-28 Thread Pawel Veselov
Hi. From what you are describing here, with the spec references, the current behavior looks like a bug (may be a performance bug only, but still). Thanks, Pawel. On 02/24/2012 12:02 PM, Kevin Sutter wrote: Hi, I recently came across this issue... OpenJPA generates SQL with an Order By

Re: Removal of unnecessary Order By clauses

2012-02-29 Thread Pawel Veselov
On 02/29/2012 11:30 AM, Pinaki Poddar wrote: that this just sounds like a bug... OpenJPA allows a java.util.List type field to maintain order without any further annotation across persistence context -- and that is a bug! Spec says that list ordering is not portable -- spec does not prohibit a

Re: Removal of unnecessary Order By clauses

2012-02-29 Thread Pawel Veselov
On Wed, Feb 29, 2012 at 12:06 PM, Pinaki Poddar ppod...@apache.org wrote: Extra performance cost that comes as a price for just wanting to use List API. That is not a sound argument. I would compare this to coming into a store, and selecting between alarm clocks. There is a $9.99 clock that

Re: Handle constraint violation

2012-07-19 Thread Pawel Veselov
Hi. On Thu, Jul 19, 2012 at 2:56 PM, José Luis Cetina maxtorz...@gmail.comwrote: Hi im triying to handle a constraint violation but i dont know how.. In my EJB i have this: try { UserTransaction userTransaction = ejbContext.getUserTransaction();

Re: Handle constraint violation

2012-07-20 Thread Pawel Veselov
points, but then you'll need to access underlying Connection object. The idea would be to commit to a save point, attempt the delete, flush, and then rollback to savepoint if it failed. 2012/7/19 Pawel Veselov pawel.vese...@gmail.com: Hi. On Thu, Jul 19, 2012 at 2:56 PM, José Luis Cetina

Re: What is the type parameter, 'X' for?

2013-04-11 Thread Pawel Veselov
On Thu, Apr 11, 2013 at 1:24 PM, Chris Wolf cwolf.a...@gmail.com wrote: ... in this interface? public interface OpenJPAQueryX extends TypedQueryX (an example would be good also) X is the class of the objects that the query is supposed to return. TypedQueryEAgent agents =

Race condition in dictionary determination?

2013-06-30 Thread Pawel Veselov
Hi. Using OpenJPA 2.1.1, I ran into this problem after I switched to custom implementation of the data source. I guess what's happening is that dictionary can no longer be determined from the class name, so it attempts to look at the URL, but the data source object is not yet populated.

autoCommit handling (2.1.1)

2013-07-02 Thread Pawel Veselov
Hi. I'm trying to understand how exactly OpenJPA does handle auto commit flag on connections. I've made sure that my connection pool always creates connections and has autoCommit set to false on them (it's Postgres, so by default, those come out with autoCommit=true). These are non-XA connections

Influencing join condition

2013-07-28 Thread Pawel Veselov
Hi. I was wondering if there was a way to influence join condition using criteria builder API. Suppose I have two tables: items and purchases. I want to build a left join between the two tables, but only for the 'current user'. In SQL, I would say: select i.xx, p.yy from items i left join

extra cross join pops up with multiple roots (2.2.2)

2013-09-06 Thread Pawel Veselov
Hi. I have two tables that don't have a defined relation, but I'm still trying to join them together in a single query, using criteria builder API. This query work as I want it to - synchronizing the rows from both tables: RootE_Application root = q.from(E_Application.class);

OpenJPA 2.3.0 packages Derby?

2014-07-05 Thread Pawel Veselov
Hi. I see that 2.3.0 has a packaged derby jar (10.8.2.2) I was wondering what the reason is, and can I yank it out even if I'm not using Derby (in my deployment, derby.jar is deployed at application server level, and openjpa is packaged along .war file) Thank you, Pawel.

Something is missing in OpenJPA 2.3.0 distribution

2014-07-05 Thread Pawel Veselov
Hi. Something seems to be missing from the libraries in the OpenJPA distro. I don't normally use the all jar, and without it, the enhancer fails with class not found of org/apache/xbean/asm4/ClassVisitor.class. The class is there in all jar, but not in any of the library jars...

Re: Something is missing in OpenJPA 2.3.0 distribution

2014-07-05 Thread Pawel Veselov
On Sat, Jul 5, 2014 at 9:20 PM, Pawel Veselov pawel.vese...@gmail.com wrote: Hi. Something seems to be missing from the libraries in the OpenJPA distro. I don't normally use the all jar, and without it, the enhancer fails with class not found of org/apache/xbean/asm4/ClassVisitor.class

Re: Serp, JDK 1.8 and Lambdas

2015-06-03 Thread Pawel Veselov
not be used by OpenJPA at runtime at all? https://issues.apache.org/jira/browse/OPENJPA-2386 On Mon, Jun 1, 2015 at 3:31 AM, Pawel Veselov pawel.vese...@gmail.com wrote: Hi. I had some Lambda code in one of my entities, and the enhancement, using 2.2.2, failed with an exception

Serp, JDK 1.8 and Lambdas

2015-06-01 Thread Pawel Veselov
Hi. I had some Lambda code in one of my entities, and the enhancement, using 2.2.2, failed with an exception. Is there a better version of Serp that I can replace whatever comes stock in 2.2.2 (that's 1.14.1)? Thank you, Pawel. Exception in thread main java.lang.IllegalArgumentException: type

Auto-deleting referenced entities.

2015-07-15 Thread Pawel Veselov
Hi. Is it possible in JPA to reference entities from another, and have them automatically delete if the reference is just removed? I.e. if the entity is: public class E_Campaign implements Accounted { @Id private long id; @OneToMany(cascade = CascadeType.ALL, mappedBy = campaign)

github mirror issues? missing files

2018-06-07 Thread Pawel Veselov
Hello. Yet another strange thing I found. I have SVN repo of OpenJPA, along with its github mirror. Examining tag 2.4.2. The tag is at r1777108, or commit 4da43efd3d57f8ea145b358042cd463c9337f4c1 There is a present file in

NPE on MapKey maps

2018-09-07 Thread Pawel Veselov
Hello. I ran into this problem, and I'm not sure what the right answer is. Consider just two entities (I've gutted them to the pieces that are relevant, I tried this on corresponding classes in org.apache.openjpa.persistence.relations package, openjpa-persistence-jdbc module): public class

More test failures - JPA spec overwritten

2018-04-08 Thread Pawel Veselov
Hello. Trying to run more tests on 2.4.2. My first compilation was successful, but now there is another phantom exception that I have no clue how to resolve. Any help would be appreciated. I haven't made any changes anywhere that should affect this... I don't know where the JPA specification is

Re: More test failures - JPA spec overwritten

2018-04-08 Thread Pawel Veselov
On Sun, Apr 8, 2018 at 5:22 PM, Pawel Veselov <pawel.vese...@gmail.com> wrote: > Trying to run more tests on 2.4.2. My first compilation was > successful, but now there is another phantom exception that I have no > clue how to resolve. Any help would be appreciated. I haven't mad

Re: More test failures - JPA spec overwritten

2018-04-09 Thread Pawel Veselov
On Mon, Apr 9, 2018 at 5:01 PM, Matthew Broadhead wrote: >> The enhancer version of the enhanced classes is 2, but the enhancer is >> 1674154, which matches the SVN revision of the enhancer, and I believe >> that's what it should be. I don't know where it gets the

Re: Repeating parameter name causes all kinds of problems?

2018-04-09 Thread Pawel Veselov
On Mon, Apr 2, 2018 at 1:03 AM, Pawel Veselov <pawel.vese...@gmail.com> wrote: > On Sun, Apr 1, 2018 at 2:51 PM, Pawel Veselov <pawel.vese...@gmail.com> wrote: >> I want to re-use the same parameter twice. However, I'm seeing all >> kinds of behavior except for the one I

Repeating parameter name causes all kinds of problems?

2018-04-01 Thread Pawel Veselov
Hello. I can't find much references to problems like this, which is surprising. May be I'm doing something that is prohibited by the spec? I want to re-use the same parameter twice. However, I'm seeing all kinds of behavior except for the one I want. This is with OpenJPA 2.4.2. This code (just

Test failures for 2.4.2

2018-04-02 Thread Pawel Veselov
Hello. I'm trying to build openjpa-2.4.2 myself. I'm seeing test failures in openjpa-xmlstore : https://pastebin.com/mvns1pDN Any idea how they can be avoided, or what the cause is? Thank you, Pawel.

Re: Repeating parameter name causes all kinds of problems?

2018-04-01 Thread Pawel Veselov
On Sun, Apr 1, 2018 at 2:51 PM, Pawel Veselov <pawel.vese...@gmail.com> wrote: > Hello. > > I can't find much references to problems like this, which is > surprising. May be I'm doing something that is prohibited by the spec? The spec OKs to use the same parameter more than on

Primary key string ids are stripped

2018-10-24 Thread Pawel Veselov
Hello. I just found out, the hard way, that OpenJPA strips the string entity IDs when doing find(). It doesn't strip those values when saving entities with corresponding primary keys. Is there a particular reason for this? It sounds weird to create an entity with primary key "0\t", but then not

Re: OpenJPA issues black hole

2019-01-20 Thread Pawel Veselov
ber 2018, 05:08:06 CET, Pawel Veselov > wrote: > > Hello. > > I've been using OpenJPA for a while, and I'd like to understand what's > going on with the bug fixing process. > > Over the course of time, I have filed a few bugs. I'm only going to > concentrate on ones

Re: OpenJPA issues black hole

2019-01-22 Thread Pawel Veselov
t; > LieGrue, > Dtrub > > > Am 20.01.2019 um 23:43 schrieb Pawel Veselov : > > > > Mark, > > > > Entschuldigung for the nagging, any luck? :) > > > >> On Tue, Jan 1, 2019 at 11:08 PM Mark Struberg > >> wrote: > >> > >&

Re: Primary key string ids are stripped

2018-11-21 Thread Pawel Veselov
t it might be better > if you could provide parts of your code in a sample. > LieGrue,strub > > On Friday, 26 October 2018, 09:55:37 CEST, Matthew Broadhead > wrote: > > can you give a small example? do you mean when the field annotated @Id > is a String then find retu

OpenJPA issues black hole

2018-12-30 Thread Pawel Veselov
Hello. I've been using OpenJPA for a while, and I'd like to understand what's going on with the bug fixing process. Over the course of time, I have filed a few bugs. I'm only going to concentrate on ones that we had to fix ourselves: OPENJPA-2733 OPENJPA-2735 OPENJPA-2736 OPENJPA-2749

Detach on cascade turns on phatonmly

2019-07-12 Thread Pawel Veselov
Hello. https://issues.apache.org/jira/browse/OPENJPA-2792 Has took me a while to track down, and leaves quite unpleasant surprises, as your entities become detached without warning, which leads to phantom NPEs at places you never expect to happen. -- With best of best regards Pawel S. Veselov

Re: Detach on cascade turns on phatonmly

2019-07-22 Thread Pawel Veselov
erns do they use to work with JPA? > > txs and LieGrue, > strub > > > > Am 12.07.2019 um 15:37 schrieb Pawel Veselov : > > > > Hello. > > > > https://issues.apache.org/jira/browse/OPENJPA-2792 > > > > Has took me a while to track down, and l

Extra table reference in UPDATE causes huge performance impact.

2019-07-22 Thread Pawel Veselov
Hello. Below are the JPQL and generated native SQL query that I have a problem with. The problem is that the SQL version has an extra table reference in the inner query. That table, unconstrained, has a number of entries, causing number of processed records jump from ~4000 to ~30,000,000, causing

Re: PESSMISTIC_READ takes out exclusive lock on Postgres

2020-02-25 Thread Pawel Veselov
t; LieGrue, > strub > > > > Am 20.02.2020 um 18:22 schrieb Pawel Veselov : > > > > Hello. > > > > I've found out that using PESSIMISTIC_READ on an entity with postgres > > uses 'for update' lock, which is actually exclusive. > > > > I understand

PESSMISTIC_READ takes out exclusive lock on Postgres

2020-02-20 Thread Pawel Veselov
Hello. I've found out that using PESSIMISTIC_READ on an entity with postgres uses 'for update' lock, which is actually exclusive. I understand JPA specification says that it's permissible to do that, but I really need a shared lock for what I'm trying to achieve. Is it possible to control

OPENJPA-2735 subquery search doesn't work for compound objects

2020-12-23 Thread Pawel Veselov
Hello. Any reason this is still not fixed in 3.1.2? This would have a rather simple query fail: delete from TABLE m where m.REF in (select E from REF E where sd.keyPart = :param) Just looks like a case that would be quite common...

CriteriaUpdate/CriteriaDelete support?

2020-12-24 Thread Pawel Veselov
Hello. I was rather excited when I saw the statement on http://openjpa.apache.org/ that 3.x releases "target" the 2.2 JPA Spec, but are *compatible* with specs 2.1 and below specs, sort of reading it as 3.x supporting 2.2 spec. My excitement was crushed with a rather heavy boulder once I saw

Re: CriteriaUpdate/CriteriaDelete support?

2020-12-29 Thread Pawel Veselov
e, > strub > > > > Am 24.12.2020 um 09:57 schrieb Pawel Veselov : > > > > Hello. > > > > I was rather excited when I saw the statement on > > http://openjpa.apache.org/ that 3.x releases "target" the 2.2 JPA > > Spec, but are *compatible*