Re: OpenJPA support for JPA 2.1: when?

2014-12-12 Thread Pinaki Poddar
May of JPA 2.1 have been developed on the branch Kevin had mentioned. As it
was quite a while I had looked at beautiful OpenJPA code (i am now a FOB in
the wobbly-goobly-gook Python/Shell Script world filled with super-wizards
:), the exact features I had implemented on that branch escapes me.

The essentials are
1. Stored Procedure support was well-cooked as it required new
constructs/concepts in OpenJPA
2. Many low-hanging features that had been part of OpenJPA in alternative
form are adapted to JPA 2.1 form

Will take a look when i get some free time. 

Any new or old committers ready to contribute to OpenJPA are welcome to
offer a hand to drive these prototypes to completion. 



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-support-for-JPA-2-1-when-tp7584157p7587494.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Audit logging in OpenJPA2.1.

2014-10-05 Thread Pinaki Poddar
> Is there a way to implement such a logging in earlier versions of OpenJPA? 

Yes.

Core OpenJPA kernel has all the necessary functionality for audit
operations.
if you are *not* interested in the 'delta' between the current and
pre-change state of an entiity, the task becomes simpler. As you have noted
a standard LifCycle Event State change callback mechnism should suffice.

>  I cannot get a reference to entity manager in event listener.
You can albeit with some work.
The persistence entity when enhanced, implements a PersistenceCapable
interface. Hence, it is safe to cast the persistence entity to a
PersistenceCapable. The PersistenceCapable.pcGetGenericContext() method
returns you an object which is a Persistence Conext -- which is same (for
all practical purpose) as an EntityManager.
The Persistence Context in OpenJPA is called Broker. So it is safe to cast
the result of PersistenceCapable.pcGetGenericContext() to Broker. Broker has
all the methods you will find on an EntityManager. Actually EntityManager is
implemented as a very thin delegation layer on Broker.

You could always get a deeper and better explanation on the source (remember
OpenJPA is Open Source :) and JavaDoc.

Regards --




-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Audit-logging-in-OpenJPA2-1-tp7587161p7587171.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: JPQL and DB2 native code

2014-08-04 Thread Pinaki Poddar
If you are interested to invoke database specific functions in query via JPA,
one compliant means is to use Criteria Query. Via Criteria query interface,
you can build a function of any name which may take zero or more arguments. 

The interface and strict type structure of the API is somewhat intimidating
than a pure and simple JPQL query string -- but it will makes some queries
possible that are not expressible in JPQL. 

Here is an old article on Criteria Query on IBM developerworks [1] with an
example of function() near the end.

Regards -- 

[1] http://www.ibm.com/developerworks/library/j-typesafejpa/



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/JPQL-and-DB2-native-code-tp7586405p7587022.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Utilizing a slice for online migration

2014-05-31 Thread Pinaki Poddar
Yes, you are on the right track.
I have considered that Slice can be used for data migration. Read data from
one Slice and if the data is touched, write it to another. 

Nowadays, I do not spend enough time on OpenJPA to help with you some real
code/prototype. But with little digging (especially where Slice writes the
same record to multiple databases for @Replicated types) -- you can use it
for online migration.

Regards --





-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Utilizing-a-slice-for-online-migration-tp7586062p7586727.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Utilizing a slice for online migration

2014-05-31 Thread Pinaki Poddar
Hello Rick,
  Your post seems to be in rather poor taste for a open source developer.
Instead of encouraging users to use a module from  a project of which you
are a member and the module has been in operation for last four years and
have been successfully used by others, your answer seem to be: "Nobody uses
Slice, so do not bother". It is not only factually incorrect, it is
inappropriate. 

   

 



-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Utilizing-a-slice-for-online-migration-tp7586062p7586726.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: @Auditable with tomee+ 1.5.2

2013-10-14 Thread Pinaki Poddar
> it seems the audit() method is not being called,

does the default auditor work? 



-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Auditable-with-tomee-1-5-2-tp7585142p7585163.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: about slice query with paging. the result have some wrong

2013-07-14 Thread Pinaki Poddar
Hi Fengyi,
  As per your reported data, the query result is not missing records, but
the page size is longer than you requested. For example if you request a
page size of P and have N slices, the the query will return P*N rows per
page. 
  This is surely a bug, albeit a minor one. A simple solution is to set the
page size to be P/N. then the actual page size will be P/N * N = P i.e what
you wanted originally. 



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/about-slice-query-with-paging-the-result-have-some-wrong-tp7584326p7584410.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: OpenJPA support for JPA 2.1: when?

2013-06-18 Thread Pinaki Poddar
Hi,

Matthew asks a pertinent question:
   > When will OpenJPA support JPA 2.1? 

Kevin's response is factual as well
> Pinaki has went so far to create a sandbox and start experimenting with an
> implementation.  Again, he's a one-man show and can't do it all.  Well, he
> probably could, but it would require a bit of work...  :-) 

I have done some analysis of the required changes to trunk to comply with
JPA 2.1. And made some preliminary implementation work. 

  But, as Kevin observes, Open Source is *not* a one-man show. It thrives on
voluntary participation, where *anyone* can contribute if they are
passionate about what they do. Not because they belong to a club of one sort
or other. 

  So for anyone reading this mail, you are welcome to express your wish to
participate in OpenJPA community. You need not to be a member of any
particular group or country, your only credential is you. You can write to
me in confidence and I will organize the due process to welcome you in the
fold.

  Someone in this thread had raised a doubt about current active
participation being dominated by the employees of a single company. But I
can assure you based on my association with many of them, that they are
excellent engineers who had earned the karma by their own merit and
open-minded enough to welcome you irrespective of who pays your bill or
which country you live. 

 
-

About complying to a 2.1 JPA spec version, we should honor a pair of key
principles that OpenJPA (or its predecessor Kodo) had always followed:
  a) it is not driven by a de jure specification and aspires to stay ahead
of the curve via innovative features (that perhaps no customer is asking for
at that point of times)
  b) its kernel is agnostic to datastore being of a particular kind (NoSQL
enthusiasts should take note ;)

While I will keep aside the later design principle for now, the former
principle applies for the current topic. This forward-looking tendency can
be observed when many "new" JPA features can be mapped onto "existing"
OpenJPA features (FetchPlan being a notable example). 

So it does sound strange when we discuss about implementing JPA 2.1 features
as if the decision is subjected to someone asking for it. 

  A Open Source group builds features not because a spec committee or a
customer, but because , the members, as engineers, think that a feature will
be useful -- today or tomorrow. Time may prove otherwise, but unless we
carry that spirit of innovation backed by our love for a technology domain,
we, as a group, will fall into the trap of factory-built, proprietary
software that is so twentieth century.

  Yes, a popular spec like JPA can provide a guideline, but our decision of
how to take OpenJPA forward should not depend on it.   






-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-support-for-JPA-2-1-when-tp7584157p7584212.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: NoSuchMethodError pcGetManagedFieldCount() error

2013-06-03 Thread Pinaki Poddar
The type of a field that represents persistent identity must be one of
java.lang.Integer, Long etc.  and well-specified by JPA specification. A
generic type (i.e. a type non-determinable at compile time) is not permitted
by spec. 

> OpenJpa implementation might be struggling to determine the "id" field
> type in my @MappedSuperclass

It is a struggle that OpenJPA is bound to lose, as any compiler will as
well. 
 



-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/NoSuchMethodError-pcGetManagedFieldCount-error-tp7584060p7584063.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


RE: Ordering results obtained through query-by-example

2013-06-03 Thread Pinaki Poddar
> So I think Pinaki wants you to replace the "qDef.from(persistentClass)" in
makeOrderList with "from": 

correct. 





-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Ordering-results-obtained-through-query-by-example-tp7584043p7584062.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Ordering results obtained through query-by-example

2013-05-31 Thread Pinaki Poddar
Most likely it is a programming error.
 
> List orderList = makeOrderList(builder,
> qDef.from(persistentClass), orderFields);

this call causes a side-effect of CROSS JOIN which is possibly not your
intention.  Your code has already called
>Root from = qDef.from(persistentClass); 
few lines earlier. While passing argument to makeOrderList(...) the second
argument joins 'persistentClass' again.


 Please change the call argument to remove the side-effect and see if that
changes anything.


  


 



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Ordering-results-obtained-through-query-by-example-tp7584043p7584058.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Ordering results obtained through query-by-example

2013-05-30 Thread Pinaki Poddar
please post 
  1. the criteria query i.e. the output of System.err.println(qDef);
  it should print a JPQL-like string

  2. the SQL generated at execution with bind parameters. OpenJPA will print
the SQL if configured as follows




   



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Ordering-results-obtained-through-query-by-example-tp7584043p7584046.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Is it possible to override the default openjpa persistence provider

2013-05-01 Thread Pinaki Poddar
> The reason is I want to override the EntityManager.

OpenJPA provides its JPA API (such as EntityManagerFactory or EntityManager
etc.) as a facade to its kernel which is general-purpose object management
facility agnostic to JPA. Similarly the kernel talks to a datastore via a
StoreManager API which is agnostic to relational database or JDBC. 
So if you want specific functional behavior, you should consider
implementing Brokerfactory and Broker interfaces that are OpenJPA equivalent
of  EntityManagerFactory and EntityManager respectively. These two
interfaces are implemented as JDBCBrokerfactory and BrokerImpl.

The examples of such extensions are available in OpenJPA source codebase.
See openjpa-slice module (especially DistributedBrokerfactory and
DistributedBrokerImpl) where similar extension works with multiple
databases.





-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Is-it-possible-to-override-the-default-openjpa-persistence-provider-tp7583807p7583825.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Insert new record + update child object

2013-04-25 Thread Pinaki Poddar
public void saveExam(Exam exam){
ejbContext.getUserTransaction().begin();
   
//DOES THIS WORK?
exam = em.merge(exam);

ejbContext.getUserTransaction().commit();
   } 



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Insert-new-record-update-child-object-tp7583389p7583780.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multi-Root queries using CriteriaBuilder result in Additional CROSS JOIN

2013-04-25 Thread Pinaki Poddar
Hi,
  
Please post the stringified form of the Criteria Query.

Simply as: System.err.println(metricQuery)
will print a JPQL-like string. 





-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multi-Root-queries-using-CriteriaBuilder-result-in-Additional-CROSS-JOIN-tp7583546p7583779.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: how to use openjpa slice Distributed with db2 v9.7

2013-04-25 Thread Pinaki Poddar
Hi,
  You can find some code examples/usage notes for Slice at the following
places

1. OpenJPA test code. Either you can checkout OpenJPA source, or browse them
with fisheye [1]. Instructions to do so are in [2]. You will find the test
cases for Slice under openjpa-slice/src/test/java folder. 

2. This article in developerworks [3] on Slice has some basic examples and
usage.

3. A JavaOne presentation on Slice [4]


[1]
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-slice/src/test/java/org/apache/openjpa/slice/TestBasic.java?view=markup
[2] http://openjpa.apache.org/source-code.html
[3] http://www.ibm.com/developerworks/java/library/os-openjpa/?ca=drs
[4]
http://www.slideshare.net/pinaki.poddar/slice-for-distributed-persistence-javaone-2010



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/how-to-use-openjpa-slice-Distributed-with-db2-v9-7-tp7583769p7583778.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: slice with db2 error

2013-04-25 Thread Pinaki Poddar
Hi,
  1. First try to remove these two properties

   
   

  2. If the error still persists, use the same JDBC connection parameters
(not the example you cited with jta data source) in a persistence.xml and
try to connect via a simple app using OpenJPA.
   



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/slice-with-db2-error-tp7583764p7583777.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: DistributionPolicy help

2013-04-01 Thread Pinaki Poddar
Hi,
  Examples of Slice Distribution Policy can be found in OpenJPA test corpus.
You can either OpenJPA source code and navigate to
openjpa-slice/src/test/java/org/apache/openjpa/slice/policy package, or you
can browse the source code in fisheye [1].

 The context variable passed to DistributionPolicy is declared as an opaque
java.lang.Object type. But in the runtime actually it is an instance of the
EntityManagerFactory on which the perisist() call has been invoked.

 The interface method distribute() should return the name of one of the
slices as declared in your persistence.xml. The object will be persisted in
that slice. 





[1]
https://fisheye6.atlassian.com/browse/openjpa/trunk/openjpa-slice/src/test/java/org/apache/openjpa/slice/policy/EvenOddDistributionPolicy.java?r=772721



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/DistributionPolicy-help-tp7583302p7583311.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Externalizer and the dirty state

2013-03-27 Thread Pinaki Poddar
Perhaps you need to post the essentials of the externalized class
DummyWrapper. With a trivial implementation of the DummyWrapper class 
public class DummyWrapper {
BigDecimal val = new BigDecimal(10);
public BigDecimal getDecimal() {
return val.setScale(6);
}
}
The SQLs that resulted with the code you posted show normal activity:  

CREATE TABLE dummy (id BIGINT NOT NULL, label VARCHAR(255), wrapper
DECIMAL(9,6), PRIMARY KEY (id))
INSERT INTO dummy (id, label, wrapper) VALUES (?, ?, ?) [params=(long) 2,
(String) test, (BigDecimal) 10.00]
END OF INSERT ***




-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Externalizer-and-the-dirty-state-tp7583219p7583261.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: CriteriaQuery on mapped-superclass does not work with orm.xml

2013-03-27 Thread Pinaki Poddar
JPA Specification version 2.0
Section 2.11.2 : Mapped Superclasses
"A mapped superclass, unlike an entity, is not queryable and must not be
passed as an argument to
EntityManager or Query operations"

  Consider using an abstract class instead.



-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/CriteriaQuery-on-mapped-superclass-does-not-work-with-orm-xml-tp7583185p7583260.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Cannot join on constant field

2013-03-27 Thread Pinaki Poddar
There is a recent commit on OPENJPA-1979



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Cannot-join-on-constant-field-tp7582928p7583259.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: connecting to multible databases

2013-03-27 Thread Pinaki Poddar
See if the following OpenJPA module called Slice meets your requirement

[1]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_slice



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp7583055p7583257.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: New CMS OpenJPA web site is now live!

2012-12-11 Thread Pinaki Poddar
All the doc links are broken on this [1] page

[1] http://openjpa.apache.org/documentation.html




-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/New-CMS-OpenJPA-web-site-is-now-live-tp7582124p7582150.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: CriteriaBuilder function() issue with MySQL...

2012-11-26 Thread Pinaki Poddar
Hi,
  Sorry for the delayed response.
  Can you call a toString() on the Criteria Query? It should print a string
that would look "JPQL-like". I need to see whether the function name
"TimeStampDiff" was available at that stage and getting garbled during
target SQL generation or not.



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/CriteriaBuilder-function-issue-with-MySQL-tp7581531p7581942.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


RE: Queries using specific SQL, e.g. functions, or specific operators - passthrough SQL pieces without full native query

2012-11-26 Thread Pinaki Poddar
Hi Michael,
  I would suggest to look into Criteria Query API's function() method [1].
It may be the answer to the problem.

[1] The section titled "Extensible datastore expressions" in 
  https://www.ibm.com/developerworks/java/library/j-typesafejpa/



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Queries-using-specific-SQL-e-g-functions-or-specific-operators-passthrough-SQL-pieces-without-full-ny-tp668856p7581941.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: openjpa-kernel : using PostgreSQL's inet operators in JPQL

2012-11-26 Thread Pinaki Poddar
Hi,
  > " I would like to use inet operators to query database"
Have you considered Criteria Query's function(...) method? The
function() is specifically designed to invoke arbitrary database functions 
in query expressions without having to extends JPQL BNF.

 > "if only there was some example how to create strategies, I've had some
rough times). "
 We will greatly appreciate if you could contribute a write-up of your
experience in designing InetFieldStrategy. We can include it in our
documentation.



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/openjpa-kernel-using-PostgreSQL-s-inet-operators-in-JPQL-tp7581619p7581940.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: What is the counterpart of @Any in hibernate?

2012-10-05 Thread Pinaki Poddar
See @Type in OpenJPA documentation.



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/What-is-the-counterpart-of-Any-in-hibernate-tp7581316p7581318.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: audit?

2012-09-12 Thread Pinaki Poddar
> It looks like Pinaki fixed this problem in trunk yesterday. 
Possibly -- added a rather weak test to verify memory growth. The original
reporter should verify.



-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/audit-tp6901099p7581084.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Can someone explain this OpenJPA trace?

2012-09-11 Thread Pinaki Poddar
a) why a multiselect() ?
b) what does q.toString() print?




-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Can-someone-explain-this-OpenJPA-trace-tp7580862p7581074.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: audit?

2012-09-11 Thread Pinaki Poddar
OpenJPA audit allows the user to choose how the audit records are treated. It
does not make any decision to store the audited record to be stored in the
same database. But that is entirely possible because the audit record
carries the states of the persistent object when it entered the persistent
context and when it is ready to be committed. However, OpenJPA audit allow
the audit record be stored in an entoirely different database or schema as
well.



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/audit-tp6901099p7581073.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Thank you, Dianne!

2012-07-01 Thread Pinaki Poddar
Dianne,
  Your solid and tenacious contributions to OpenJPA will be fondly
remembered. 

  Have a great time.

  With sincere regards --



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Thank-you-Dianne-tp7580434p7580436.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: OpenJPA Audit

2012-06-27 Thread Pinaki Poddar
Kevin,
  I may have done something non-kosher with openjpa.Auditor property. And I
did not test it in OSGi environment either. Bengt had reported earlier
classloading issues. It may be worthwhile to try this Auditor within an OSGi
environment, if one is set up to work with OpenJPA.
  First thing we need to ascertain whether it is openjpa.Auditor is loaded
in a non-standard way than other custom plugins. But unfortunately I do not
have an OSGi environment to test. 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-Audit-tp7580377p7580424.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: OpenJPA Audit

2012-06-26 Thread Pinaki Poddar
Hi,
 > Wow. 
  Good to know that you have found this audit facility useful.

  I have added a test that shows an example of recording
insert/update/delete of persistence instances in the same database. (See my
latest commits)


-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-Audit-tp7580377p7580406.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Lifecycle listener invoked on Query

2012-02-29 Thread Pinaki Poddar
I think the current OpenJPA status is such that if you want dirty objects in
an in-flight transaction be included in the result of a query, OpenJPA will
flush the dirty objects to database and then evaluate the query on database
if openjpa.IgnoreChanges=false. 
 
If openjpa.IgnoreChanges=true, OpenJPA will ignore the dirty in-memory
objects and evaluate the query on the unflushed database.

>From your description it looks like you want openjpa.IgnoreChanges=false.
But that setting will also cause a flush and hence a post update
notification.

I have not taken a look at the current code and simply trying to recollect
from my memory. Others may be able to advise you on other options or
solutions.

Also note that using proprietary  OpenJPA API, you can query *only* on the
in-memory objects (may work here as you seem to be looking for a single
object).

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Lifecycle-listener-invoked-on-Query-tp7329975p7330576.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Removal of unnecessary "Order By" clauses

2012-02-29 Thread Pinaki Poddar
> Extra performance cost that comes as a price for just wanting to use List
API. 
That is not a sound argument. 
Firstly, a performance cost is not a bug. 
Secondly, a feature i.e. to have List maintain order, it is natural that a
provider will need some code and code costs. But that cost can not be termed
as a performance cost. That is a feature cost.

With current capabilities of OpenJPA, a user determines and has complete
control on whether s/he wants Set or List to represent a domain model
properties.  If a user does use List API it means s/he requires ordering
semantics. And that declaration is sufficient for OpenJPA to maintain
element ordering for him/her. So what is the confusion about "just wanting
to use List API"?


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Removal-of-unnecessary-Order-By-clauses-tp7315925p7330537.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Removal of unnecessary "Order By" clauses

2012-02-29 Thread Pinaki Poddar
> 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
vendor to provide features. So what is the bug here?



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Removal-of-unnecessary-Order-By-clauses-tp7315925p7330422.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Lifecycle listener invoked on Query

2012-02-29 Thread Pinaki Poddar
The likely cause of this observation is:
the query determined that current cache holds dirty objects that can affect
the result of the query. Hence it flushed them and a post update was
notified.  

Try specifying openjpa.IgnoreCache=true

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Lifecycle-listener-invoked-on-Query-tp7329975p7330296.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Removal of unnecessary "Order By" clauses

2012-02-29 Thread Pinaki Poddar
A persistent property declared as a list maintains its order across
persistence contexts is a useful feature. It does not sound unnecessary to
me as an user. If the user does not require the order, the field can be
declared as Collection or Set. Why to take away an useful feature? 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Removal-of-unnecessary-Order-By-clauses-tp7315925p7330183.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: re-attaching detached entities

2012-01-25 Thread Pinaki Poddar
try merging to a different em.

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/re-attaching-detached-entities-tp7221649p7223256.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: OpenJPA 2.1.1 and read entitys being marked as dirty

2012-01-17 Thread Pinaki Poddar
shows that Account.class had been enhanced before (possibly with a different
version of openjpa library).
Simply delete the Account.class file, recompile Account.java and run
org.apache.openjpa.enhance.PCEnhancer on it. 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-2-1-1-and-read-entitys-being-marked-as-dirty-tp7196689p7197800.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Mapping tool statement delimeter

2012-01-17 Thread Pinaki Poddar
Hi,
  A change (revision 1232449) is committed on trunk against [1].
  If possible please verify and let us know. 

[1] https://issues.apache.org/jira/browse/OPENJPA-2108


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Mapping-tool-statement-delimeter-tp7184579p7196840.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Fetch lazy modeled entities in multiple hierarchical levels with criteria api

2012-01-17 Thread Pinaki Poddar
Hi,
  Please refer to documentation on OpenJPA FetchPlan [1].

[1]
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_fetch

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Fetch-lazy-modeled-entities-in-multiple-hierarchical-levels-with-criteria-api-tp7185675p7196640.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: ANN: OpenJPA Intellij plugin

2012-01-05 Thread Pinaki Poddar
Thank you for your contribution and interest in OpenJPA.
Mark Struberg/Donald Woods have developed/managed development tools for
OpenJPA and you can reach them to explore how your contribution can be
integrated in OpenJPA distribution. 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/ANN-OpenJPA-Intellij-plugin-tp7132632p7154857.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Happy 2012

2012-01-03 Thread Pinaki Poddar
To all those brave souls of Open Source users:
   Let a new year refresh and renew joy and wonder of your world.



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Happy-2012-tp7147044p7147044.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: changing specific openjpa.jdbc.DBDictionary

2012-01-03 Thread Pinaki Poddar
I agree with your disagreement. A JPA provider runtime can be more flexibly
configured at runtime via different means than to have all the details
supplied via *hard-coded* persistence.xml. One mechanics, as you have
mentioned, can be via JNDI registered data source. The other (non-exclusive
of the former) could be to pass properties in a Map during
EntityManagerFactory (Persistence.createEntityManagereFactory(String,Map)
bootstrap method. 
May be you can find an elegant solution by identifying the database type
*before* the bootstrap and pass DBDictonary or other connection parameters
(URL etc.) accordingly.  

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/changing-specific-openjpa-jdbc-DBDictionary-tp7143394p7147038.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: changing specific openjpa.jdbc.DBDictionary

2012-01-02 Thread Pinaki Poddar
Nope, sorry. 
For a different database (with a different URL), you will require a
different persistence.xml anyway.

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/changing-specific-openjpa-jdbc-DBDictionary-tp7143394p7144915.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: left joins, wheres and IN

2011-12-28 Thread Pinaki Poddar
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}) 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/left-joins-wheres-and-IN-tp7131885p7133073.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


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

2011-12-27 Thread Pinaki Poddar
"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 must be public or protected."
JPA 2.0 Section 2.2

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Lazy-many-to-many-properties-don-t-load-on-demand-2-1-1-tp7129842p7131059.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


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

2011-12-27 Thread Pinaki Poddar
> @ManyToMany(fetch = FetchType.LAZY, mappedBy = "categories")
> public Collection apps; 

change 'public' to 'private'

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Lazy-many-to-many-properties-don-t-load-on-demand-2-1-1-tp7129842p7130527.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Exception initializing openJPA - the named BrokerFactory is not valid

2011-12-21 Thread Pinaki Poddar
I do not have time to download and analyze the package layout of a
deployment.
The JPA bootstrap (Persistence.createEntityMangerFactory(...)), I believe,
uses thread context classloader to load the provider's implementation (i.e.
OpenJPA classes). So make sure that
Persistence.createEntityMangerFactory(...) is called by a thread whose
context classloader can load OpenJPA classes. 
Given different classloading regime in JEE/Servlet or other containers, I am
sorry that I can not give you a more accurate answer.


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Exception-initializing-openJPA-the-named-BrokerFactory-is-not-valid-tp7108046p7117036.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: How to configure transaction timeout?

2011-12-21 Thread Pinaki Poddar
> they will still cause the transaction to fail - right? 
right (assuming JPA transaction is enlisted in Aries transaction manager's
global transaction).

> Often the most difficult refactoring is also the most necessary... 
It is bane of our time that we tend to prefer what is urgent rather than
what is important.  

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/How-to-configure-transaction-timeout-tp7092641p7117020.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: How to configure transaction timeout?

2011-12-21 Thread Pinaki Poddar
Hi Bengt,
  One way will be to set timeouts of lock and query in persistence.xml. 




  It is also possible to set these timeouts for individual query (passing
them as query hints) or explicit locking via em.lock(...) API calls.

PS: I know I have not solved the Auditor classloading in OSGi environment.
Actually a large experiment to do that failed. I will make another attempt
to solve it within a smaller scope.
 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/How-to-configure-transaction-timeout-tp7092641p7115968.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Auditing: Tests and maps

2011-12-21 Thread Pinaki Poddar
Hi Christopher,

   > a.getStringAttributes().get("key").setValue("new value")); 

   This line is the culprit (or JPA as a whole is). It is a conceptual
problem with JPA, in general.
JPA is managing the field Map stringAttributes, but
it can not understand that a value in the Map has been directly changed
underneath. One way will be to rewrite it as:

   a.getStringAttributes().put("key", new StringAttribute("new value")); 

  This way a JPA runtime (which has proxied the Map to track changes) will
become aware that the Map is dirty.
 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Auditing-Tests-and-maps-tp7067224p7115915.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: weird java.util.EmptyStackException

2011-12-21 Thread Pinaki Poddar
Hi Marc,
  If possible, please verify if the change associated with OPENJPA-2098 [1]
solves this issue. Looks like a bug.


[1] https://issues.apache.org/jira/browse/OPENJPA-2098

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/weird-java-util-EmptyStackException-tp7106379p7115880.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Exception initializing openJPA - the named BrokerFactory is not valid

2011-12-21 Thread Pinaki Poddar
Most likely the problem lies with the packaging layout of your application
classes + openjpa libraries + JPA spec library.
What is the layout of the deployed application package?


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Exception-initializing-openJPA-the-named-BrokerFactory-is-not-valid-tp7108046p7115825.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Delete OptimisticLock exception, when entity appears 2x in cascade graph

2011-10-13 Thread Pinaki Poddar
Hi,
> I'm not at liberty to change this structure or the RI. 
  did you tell OpenJPA to read the database foreign key constraints? OpenJPA
update can topologically sort a to-be-committed graph of objects to honor
database constraints -- but the quality of sort depends on supplied
information. 
  If you have not, please see openjpa.jdbc.SynchronizeMappings property.

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Delete-OptimisticLock-exception-when-entity-appears-2x-in-cascade-graph-tp6882907p660.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: how to get db generated values on persist

2011-10-13 Thread Pinaki Poddar
flush();

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/how-to-get-db-generated-values-on-persist-tp6883308p638.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Antwort: Re: OpenJPA 1.2: EntityExistsException on em.persist() for Entity that is no longer present in DB

2011-09-30 Thread Pinaki Poddar
Hello Heiko,
  Please tell me few things
  1. Does the Lock object declare a reference to the entity it is supposed
to lock?
  2. Can the entities declare a reference to a Lock object?

  The above questions basically to understand whether the persistent domain
model will allow a relationship between Lock and Locked object. If it does,
can that relation be bi-directional or uni-directional? If only
uni-directional what is the directionality (or as JPA calls it: who owns the
relation?).

  3. Looks like the application prefers to create and delete Lock object
themselves as opposed to modify/update a lock object. I prefer that a Lock
object be modified when it relinquishes its lock on A and grabs control of
B. In your application, it seems that LockA object will be destroyed/deleted
and new LockB object will be created. Please explain for my understanding
why you preferred the create+delete style over modify.

 Once I hear the response, I will offer my $0.02



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-1-2-EntityExistsException-on-em-persist-for-Entity-that-is-no-longer-present-in-DB-tp6819702p6849229.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: OpenMeetings refactored from Hibernate to openJPA completed and released

2011-09-30 Thread Pinaki Poddar
Hello Sebastian,
> yet another Open Source project powered by Apache OpenJPA! 
  That is wonderful news. 
 
  We, at OpenJPA, appreciate your kind gesture of  posting the message.


  

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenMeetings-refactored-from-Hibernate-to-openJPA-completed-and-released-tp6844745p6849194.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Problems getting the old state of a Map / auditing

2011-09-28 Thread Pinaki Poddar
> I'm looking forward to the next release then! :) 

Following Linus' Law (""given enough eyeballs, all bugs are shallow"), if
more people test it out, then OpenJPA will have a "bug-free" release.

I was hoping that so much interest in Auditing (a mail chain with 60+
replies) will make some people to try out the new Audit facility. It is
designed with the view that the actual audit information and destination of
that information is controlled by the user application.

So far, Bengt had been trying it out and he did report that the customized,
user-written Auditor failed to plug-in in OSGi environment (which I have not
yet fixed or able to fix). Otherwise, he found the API and functionality
usable.



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Problems-getting-the-old-state-of-a-Map-auditing-tp6807638p6841782.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


RE: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
> Please run the following code (*preferably* from a command-line)
I will change that *preferably* to a *must*.

And ensure *nothing else* is in your classpath (other than the program
itself :)

As you can see that the problem can be reproduced even without OpenJPA. It
is caused by the environmental set up which I find to difficult to debug via
email.


-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/problems-running-JPA-standalone-outside-of-container-tp6838028p6841367.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


RE: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
We are in difficult territory now.  The error shows that the SAXParser does
not recognize a property that OpenJPA is attempting to set before using the
parser. 
Now, I ran a small test and my SAXFactory/Parser are same as yours. I am
using JDK 1.5.

Please run the following code (preferably from a command-line) and see how
it behaves in your environment.

public void testParserProperty() throws Exception {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
System.err.println(factory.getClass());
System.err.println(parser.getClass());


parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage";,
 
"http://www.w3.org/2001/XMLSchema";);
}

How are you running this program, from command-line or via Ant or other
build facilities?


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/problems-running-JPA-standalone-outside-of-container-tp6838028p6841194.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
Oops,
Please do this to see which parser is active

SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
System.err.println("Factory: " + factory.getClass().getName());
System.err.println("Parser: " + parser.getClass().getName());

before you call Persistence.createEntityManagerFactory().


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/problems-running-JPA-standalone-outside-of-container-tp6838028p6840929.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
> gnu.xml.aelfred2.JAXPFactory
This is the most likely cause of the problem. This SAX parser is not part of
standard Java runtime libraries, afaik. So I am assuming that the execution
classpath have explicitly included this library. 
I would suggest you remove this library from classpath. Java runtime
libraries come with default SAX parsers and they should be sufficient for
OpenJPA to parse the XML files it needs to. 

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/problems-running-JPA-standalone-outside-of-container-tp6838028p6840786.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
> Does OpenJPA really support standalone usage? 
Yes.

> org.xml.sax.SAXNotRecognizedException:
> http://java.sun.com/xml/jaxp/properties/schemaLanguage
Most likely the problem lies with XML parsers available in your environment.

1. How are you invoking the standalone program?
2. What SAXParser is active? Try
   System.err.println(SAXParserFactory.newInstance().getClass());
  in a simple one-line program in the same environment to find out.


-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/problems-running-JPA-standalone-outside-of-container-tp6838028p6840318.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multithreading problem

2011-09-28 Thread Pinaki Poddar
Concurrent threads can operate on an OpenJPA EntityManager. However, by
default,  EntityManager is not thread-safe. Try


Please note that this flag will ensure that OpenJPA will protect all its
internal data structures for concurrent access. But the persistent entities
being operated upon are in user control. The user application has to ensure
their thread-safety.

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multithreading-problem-tp6839678p6840293.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: How to Enable Buildtime entity enhancement in RSA?

2011-09-27 Thread Pinaki Poddar
> Does meta model generation have impact on performance? 
no

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/How-to-Enable-Buildtime-entity-enhancement-in-RSA-tp6836583p6837991.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multiple concurrent threads attempted to access a single broker

2011-09-27 Thread Pinaki Poddar
Tell me few things:
 1. a functionDO carries multiple entities. Right?
 2. Do all these entities belong to the same business/persistence unit?
 3. If they belong to different persistent unit, is it permissible that
entities of unit A get committed, but entities of unit B fail to commit?
 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6836131.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multiple concurrent threads attempted to access a single broker

2011-09-23 Thread Pinaki Poddar
2) It extract Obj1 from functionDO and call our framework.save(obj1)
   - framework will persist into db and then close em. (code is as per
previous post)
3) it extract obj2 from functionDO and call our framework.save(obj2)
   - framework will persist into db and then close em. (code is as per
previous post) 

> It will rollback since it is part of single transaction. 

But according to your description, at step (2) you have already committed
and closed. How will roll back?

May be I am missing the idea.  

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6825059.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multiple concurrent threads attempted to access a single broker

2011-09-23 Thread Pinaki Poddar
In this framework of yours, what happens when (2) transaction succeeds, but
(3) transaction fails?


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6825007.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multiple concurrent threads attempted to access a single broker

2011-09-23 Thread Pinaki Poddar
The core issue is thread-transaction affinity i.e. which thread executes
which transaction. Unless you elaborate on threading model, my answers will
be incomplete.

The issues you are now seeing because your application is trying to be
responsible for the resource management concerns that are traditionally
handled by a container. 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6824864.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multiple concurrent threads attempted to access a single broker

2011-09-23 Thread Pinaki Poddar
Hi,
 Few guidelines:
  1. stick to the principle of caching EntityManagerFactories by their
respective unit names. Do not cache EntityManagers. 

  2. Use a threading model that ensures a particular EntityManager
transaction is executed in a single thread. You need to tell us more about
your threading model for us to comment on how to do that reliably. 

  3. Decide the scope of EntityManagers. There are two scopes available:
TRANSACTION and EXTENDED. In a TRANSACTION scope, an EntityManager lives for
a transaction. In EXTENDED mode, an EntityManager lives for multiple
transactions. In former, you close the EntityManager after every transaction
commit in a finally block as you have done. In the later scope, you do not.
The appropriate scope is determined by your applications usage of data and I
can not provide a general guideline. 
   In a multi-threaded environment, with EXTENDED scope EntityManagers,
answer to (2) i.e. the affinity of thread and transactions becomes more
significant. 

  You may like to go through one way of using EXTENDED scope EntityManagers
in a multi-threaded environment in OpenBooks sample available with OpenJPA
distribution (see a class PersistenceService and its comments :). 



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6824688.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multiple concurrent threads attempted to access a single broker

2011-09-23 Thread Pinaki Poddar
I will not claim that it will solve the issue, but I think it is the right
direction/design towards solving the issue. Please let us know the results
if you follow this approach. 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6824457.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: AW: Diamond model and foreign keys

2011-09-23 Thread Pinaki Poddar
Was it @ForeignKey(implicit=true)?

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Diamond-model-and-foreign-keys-tp6819272p6824439.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multiple concurrent threads attempted to access a single broker

2011-09-22 Thread Pinaki Poddar
That is what was hinted by EntityManageers are poor candidate for caching (at
least by an application). 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6821063.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multiple concurrent threads attempted to access a single broker

2011-09-22 Thread Pinaki Poddar
> do you think that could be the issue? 
Partly, yes.
But if you close() the EntityManagers, you will have a bunch of closed
EntityManagers in your map. Not going to help.

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6821051.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: OpenJPA 1.2: EntityExistsException on em.persist() for Entity that is no longer present in DB

2011-09-22 Thread Pinaki Poddar
Hi Heiko,
  Instead of creating/deleting LockEntity, have a boolean state field
isLocked. 
  Set/unset it as the application logic demands
  always flush on mutation
  always refresh on access.

  But why a separate entity, why not using database locks itself?


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-1-2-EntityExistsException-on-em-persist-for-Entity-that-is-no-longer-present-in-DB-tp6819702p6821041.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Problems getting the old state of a Map / auditing

2011-09-22 Thread Pinaki Poddar
Hi Christopher,
  The "old" value is not available *externally* via SaveFieldManager.  That
is why all that work gone in writing an Auditor, as I had mentioned earlier.


-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Problems-getting-the-old-state-of-a-Map-auditing-tp6807638p6821002.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Multiple concurrent threads attempted to access a single broker

2011-09-22 Thread Pinaki Poddar
Hi Chintan,
  The error message is rather obvious -- in not it? 
As a suggestion, consider 
private static Map<String, EntityManagerFactory> buEntityMap;
instead of 
private static Map<String, List<EntityManager>> buEntityMap;

EntityManagers have shorter life cycle and not so effective as cached items.
On the other hand EntityManagerFactory are ideally created once in the
entire life time of an application and good candidate to be remembered. 

  See if that solves the problem of multiple threads entering a single
EntityManager. 

 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Multiple-concurrent-threads-attempted-to-access-a-single-broker-tp6820896p6820989.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: AW: Diamond model and foreign keys

2011-09-22 Thread Pinaki Poddar
Hi,
  > a solution similar to b) (with Object as a part of EmbeddedKey) was
implemented in my original project as the error first occured.

  Why made you change that model?

> rather strange that OpenJPA makes everything correct having less
> information
  It is not strange. When it has duplicate info and no knowledge of that
they are duplicate, it gets confused. If there is only one piece of
information and no duplicate -- no confusion.

> the duplicate mapping comes from the OpenJPA reverse mapping tool.
I noticed that. But here is a deeper chasm. In relational database
references are inherently bi-directional i.e. a foreign key represents a
bi-directional relation. In Java world, all references are uni-directional.
The code has to ensure the semantics of referential consistency. That deep
chasm is what ORM "tries" to bridge, and fails at times as you may have
noticed :)

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Diamond-model-and-foreign-keys-tp6819272p6820960.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Diamond model and foreign keys

2011-09-22 Thread Pinaki Poddar
Hi Michael,
  The problem could be in domain model/mapping definition. The model follows
a "duplicate mapping" approach. Let me explain what I mean by "duplicate 
mapping" in the context of your application.

public class Seasontime {
@ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
@JoinColumn(name="hotel_idhotel", columnDefinition="INT")
private Hotel hotel;

@Id
@Column(name="hotel_idhotel", columnDefinition="INT")
private int hotelIdhotel;

Now in this model, both fields "Hotel hotel" and "int hotelIdhotel" refer to
the same "logical" thing i.e. a Hotel object, but in two different ways. A
JPA runtime, however, has little clue that they mean the same thing. 
To make JPA understand this "implicit" sameness of these two fields, there
are two possibilities
a) annotate "int hotelIdhotel" with @ForeignKey(implicit=true) (see
@ForeignKey documentation for details)
b) remove the ""int hotelIdhotel" field altogether. Instead annotate the
"Hotel hotel" as @Id. JPA 2.0 supports a object reference as a primary key
either as a simple key or part of a compound key. I prefer this approach
because it avoids the "duplicate mapping" problem and results into cleaner
domain model. 
Examples of such modeling technique can be found in OpenBooks example
distributed with OpenJPA.

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Diamond-model-and-foreign-keys-tp6819272p6820601.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Problems getting the old state of a Map / auditing

2011-09-19 Thread Pinaki Poddar
Hi Christopher,
   If the context allows, you can try the following method in
OpenJPAEntityManager

/**
 * Make the named field of the given object dirty.
 */
public void dirty(Object o, String field);


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Problems-getting-the-old-state-of-a-Map-auditing-tp6807638p6810207.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Why SaveFieldManager without state? (Auditing)

2011-09-14 Thread Pinaki Poddar
Hi Christopher,
  Noticed that auditing is a favorite topic, we have added a new audit
capability [1] in OpenJPA.
To answer your question, did you read the last two lines of my blogs -- it
mentions a RestoreState flag.  

[1]
http://openjpa.208410.n2.nabble.com/OpenJPA-Audit-Facility-tc6722915.html



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Why-SaveFieldManager-without-state-Auditing-tp6792743p6793537.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: AW: OpenJPA (with slice) multithreaded scaling issues

2011-09-13 Thread Pinaki Poddar
Michael,
  1. openjpa.Multithreaded=false -- right?
  2. A single user thread is accessing each entity manager -- right? That is
no entity manager is being accessed by more than one concurrent thread. 


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-with-slice-multithreaded-scaling-issues-tp6784525p6788333.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: OpenJPA (with slice) multithreaded scaling issues

2011-09-12 Thread Pinaki Poddar
Michael,
  The lock contention seems to be at a different place than at JDBC layer.
Can you please set
openjpa.jdbc.SQLQueryCache=false and see if th elock contention is reduced?


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-with-slice-multithreaded-scaling-issues-tp6784525p6786203.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Auditor and OSGi

2011-09-07 Thread Pinaki Poddar
The auditor is plugged-in in an unusual way than other plug-ins. So that
might be causing this failure. But please do the following:
1. Configure any other OpenJPA plugin that takes a fully-qualified class
name as property value e.g. [1]
2. Supply a org.acme.Foo class for it and package exactly the way you have
packaged the Auditor implementation class. 
3. Verify if the plugged-in class is loaded 

We will know whether it is a generic failure with loading plug-in in OSGi
environment or specific to Auditor. 

[1]
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#openjpa.ClassResolver

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Auditor-and-OSGi-tp6759170p6769605.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: TableGenerator: interesting unspecified behavior?

2011-08-30 Thread Pinaki Poddar
> Did the OpenJPA folks do this because they thought it was a nice thing to
> do, or because they were under the impression the specification implied
> it?

OpenJPA is a misnomer, in a sense. Most of OpenJPA existed six/seven years
*before* JPA 1.0 specification came into being. So my guess would be that
the feature predates the specification.  

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/TableGenerator-interesting-unspecified-behavior-tp6743685p6743785.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Like issue with @Embedded attribute with Spring Data JPA

2011-08-29 Thread Pinaki Poddar
> at org.apache.openjpa.persistence.criteria.PathImpl.get(PathImpl.java:270)
> at
> org.springframework.data.jpa.repository.query.JpaQueryCreator.toPredicate(JpaQueryCreator.java:204)

Looks like Spring (JpaQueryCreator) is building a Criteria query from form
input. That code needs to split the dot separated path to individual path
segments. 

> Do you expect a object-graph string in this method? 
no.

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Like-issue-with-Embedded-attribute-with-Spring-Data-JPA-tp6735592p6739467.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Large result sets with PostgreSQL and Slice

2011-08-24 Thread Pinaki Poddar
Hi,
  Can you please post a stacktrace?


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Large-result-sets-with-PostgreSQL-and-Slice-tp6720435p6720534.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Optimistic Lock Exception not thrown with @version

2011-08-24 Thread Pinaki Poddar
Hi,
  As you have explicitly acquired a lock, a
javax.persistence.LockTimeoutException perhaps would be more appropriate
than javax.persistence.OptimisticLockException.
  In either case, OpenJPA translates database level SQL exceptions by their
error code to application-visible exceptions such as
javax.persistence.OptimisticLockException. This translation is specified in
a resource file named "sql-error-state-codes.xml". 
  Given the wide variations of SQL error codes by different database
drivers, we could only populate this translator file with some of the known
error codes and it is by no means conclusive.

  In this case, for example, SQL error code 1222 from SQLServer database is
*not* mentioned in the translator file. So OpenJPA defaulted to a generic
exception. 

  Normally, we add error codes for specific database as and when the users
encounter/report such errors.

For a quick turnaround, here is a suggestion:

1. extract the translator file "sql-error-state-codes.xml" from OpenJPA.jar
2. edit it. The edit should add the error code 1222 in  or
 clause (depending on whether the error should be translated as
OptimisticLockException or LockTimeoutException) of the appropriate database
dictionary section.
3. update OpenJPA.jar with the edited file

Please let us know if you carry out this experiment. We will then commit the
change to the original translator file.


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Optimistic-Lock-Exception-not-thrown-with-version-tp6271170p6720526.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: illogical java.lang.IllegalArgumentException: Input parameter "ids" is empty

2011-08-23 Thread Pinaki Poddar
Hi,
  On trunk version, JPQL query accepts empty list for IN parameter.
  Following pass:
public void testEmptyInExpression() {
String jpql = "select o from Book o where o.ISBN in (:ids)";
List ids = new ArrayList();
assertTrue(_em.createQuery(jpql).setParameter("ids",
ids).getResultList().isEmpty());
}

  For further investigation, please post
  1. The query string
  2. Exact way of setting the IN parameter values
  3. Error stack


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/illogical-java-lang-IllegalArgumentException-Input-parameter-ids-is-empty-tp6716202p6717297.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: AW: Slice setFirstResult with setMaxResults broken?

2011-08-22 Thread Pinaki Poddar
> is it so hard to do? It's not very efficient, I guess. 
Please note that Slice currently does work for a) range queries b) order by
queries across multiple slices. These facilities do work in similar
algorithm you had outlined. They are also efficient in merging/ordering
several lists that are themselves ordered.
It is the cross-section of (merging + ordering + applying a range) that is
broken. 

The problem is not hard per se. The factor is Slice had followed throughout
a composite design pattern. That is to say that Slice is implemented with
minimal code of its own. It simply leverages all the code of core OpenJPA
kernel and provides a composite layer on top of that.  

OpenJPA kernel has facilities of handling query results from multiple
results or ordering them. Slice simply makes a judicious usage of these
facilities. In such usage, *something* is amiss while merging + ordering + 
range operations are applied simultaneously. I am sorry that I do not have
sufficient bandwidth currently to investigate it further that being vague
about "something*. But the is quite likely hidden in the way the core
OpenJPA facilities operate while merging+ordering+range operation 

The relevant code for these operations are in
1.
org.apache.openjpa.slice.jdbc.DistributedStoreQuery$ParallelExecutor#executeQuery(...)
2. org.apache.openjpa.kernel.OrderingMergedResultObjectProvider
3. org.apache.openjpa.lib.rop.RangeResultObjectProvider
4. org.apache.openjpa.lib.rop.MergedResultObjectProvider

Some brave code warrior needs to take a look. 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Slice-setFirstResult-with-setMaxResults-broken-tp6695977p6712270.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Slice setFirstResult with setMaxResults broken?

2011-08-17 Thread Pinaki Poddar
> Slice setFirstResult with setMaxResults broken?
If the query has a order by clause, then yes.  Just noticed.
Tricky/interesting problem to solve. Any brave code warrior?


-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Slice-setFirstResult-with-setMaxResults-broken-tp6695977p6697690.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Problems when using "openjpa.MetaDataFactory" Property

2011-08-17 Thread Pinaki Poddar
Try something similar with Slice, where the database is same, but two slices
use different schema.

 
  
  
  
  

where you store the new objects are determined by slice.DistributionPolicy.
Hence, it is possible to store related objects in separate slices.


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Problems-when-using-openjpa-MetaDataFactory-Property-tp6671704p6696082.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Problems when using "openjpa.MetaDataFactory" Property

2011-08-15 Thread Pinaki Poddar
Will you elaborate what is meant by Qualifier in this context?
Where are the records for two entities that need to be joined? In two
different schema in the same database?
Two separate database?


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Problems-when-using-openjpa-MetaDataFactory-Property-tp6671704p6687995.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Best practice: Overriding equals() in entities?

2011-08-10 Thread Pinaki Poddar
> What are your experiences and best practices? 

semantics of equals(Object other) should stay close to equate the fields
that constitute persistent identity of a type.

// Two distinct contexts
EntityManager em1 = ...;
EntityManager em2 = ...;

// One user-visible persistent identity
Object pid = ...;

// Access a persistent instance in two separate contexts
X pc1 = em1.find(X.class, pid);
X pc2 = em2.find(X.class, pid);

// Access their persistent identity in distinct contexts
Object id1 = em1.getObjectId(pc1);
Object id2 = em2.getObjectId(pc2);

// These assertions are true by design
assertNotSame(pc1, pc2); // same persistent data gets realized as distinct
objects in distinct context
assertEquals(id1, id2);  // their persistent identity equals by value

// The user-written equals() *should* honor the following
assertEquals(pc1, pc2);



   


-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Best-practice-Overriding-equals-in-entities-tp6672154p6673341.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-08-08 Thread Pinaki Poddar
Thank you for testing and validating the new changes.
Enjoy Slice :)



-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6664880.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Slice and connection pools

2011-08-03 Thread Pinaki Poddar
Mike,
> I don't think we've done much (any) experimentation with slice + Tomcat's
> connection pool. 
If a normal single-unit JPA can use Tomcat's connection pool, then a slice
should as well (at least in theory:). 

Slice does not make any special arrangements for connection, it merely uses
JDBCConfiguration for each slice and somehow stitches up all the
configurations into a single DistributedConfiguration so that the client
(i.e. EntityManager or Broker) continue to function as if it is connected to
a single (albeit virtual) database. 

So in case theory does not work in practice (which theories seldom do), the
cost of repair is not high. 

Thanks for updating the manual. 

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Slice-and-connection-pools-tp6643295p6649891.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Slice and connection pools

2011-08-03 Thread Pinaki Poddar
The connection pooling can be configured for each slice as you would do
normally [1] for a single database. The property names however will change.



However, we have introduced some new mechanics that can configure a
connection pool automagically when commons dbcp in classpath. I do not think
that this new mechanics have taken Slice connection establishment into
account. 


[1]
http://openjpa.apache.org/faq.html#FAQ-HowdoIenableconnectionpoolinginOpenJPA%253F

-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Slice-and-connection-pools-tp6643295p6649074.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Native SQL Query

2011-08-02 Thread Pinaki Poddar
Hi,
  I just cross checked with a native SQL query on Slice. It does run. 
Though the new addition lacked thorough testing, I would not expect the
error you have reported provided the new changes are applied in your
environment. 

To ensure that the change is available in your environment, please do the
following:

1. $ java -jar /path/to/openjpa.jar
this will print the SVN reversion number openjpa is built with

2. Check whether following class is present in the distribution (because
this is the newly added class)
org.apache.openjpa.slice.jdbc.DistributedSQLStoreQuery


-
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6646315.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


  1   2   3   4   5   6   7   8   >