Jörn Gersdorf | 26 Feb 08:15 2015

Commercial Support?

Hi all,

are you aware of any company offering commercial support for OpenJPA?
Google did not help me in that case.

Thank you.

Kind regards,
Jörn
Hal Hildebrand | 22 Feb 22:29 2015

Lifecycle events?

So, I’m trying to use the lifecycle events on the OpenJPAEntityManagerSPI.  I’ve created a class which
implements PersistListener, UpdateListener, DeleteListener.  I’ve registered an instance of this
class as a lifecycle listener:

OpenJPAEntityManagerSPI openJpaEm = em.unwrap(OpenJPAEntityManagerSPI.class);
openJpaEm.addLifecycleListener(this);

This does not seem to do anything at all.  I’ve got printlns in every event and I get nothing.  I have
registered the txn listener successfully, and that works great.

Is there something I’m missing here?

Any help appreciated.

Thanks,

-Hal
padamstx | 19 Feb 02:10 2015
Picon

Problem when using <at> Generated with non-primary key column

I'm using v2.2.3 of OpenJPA with DB2 v10.5 and I've run across a problem that
occurs when an entity contains a field annotated with  <at> Generated but yet the
field is not the primary key for the entity.

Here's an approximation of my entity:

 <at> Entity
 <at> Table(name="A")
public class A {
    private int id;
    private int realId;
    private String someField;

    public A() { }

    public A(int realId) { this.realId = realId; }

     <at> Basic
     <at> GeneratedValue(strategy=GenerationType.IDENTITY)
     <at> Column(unique=true, insertable=false, updatable=false)
    public int getId() { return id; }

    public void setId(int id) { this.id = id; }

     <at> XmlElement
     <at> Id
     <at> Column(name="REAL_ID", insertable=false, updatable=false)
    public int getRealId() { return realId; }

    public void setRealId(int realId) { this.realId = realId; }
(Continue reading)

Leonardo K. Shikida | 16 Feb 11:38 2015
Picon

strange qbe query for tomee 1.6.0 stable (OpenJPA 2.3.0-nonfinal-1540826)

Hi

I have a query like this

    public List<E> qbe(E example) {
        OpenJPACriteriaBuilder cb = (OpenJPACriteriaBuilder)
entityManager.getCriteriaBuilder();
        CriteriaQuery<E> q = cb.createQuery(clazz);
        Root<E> entity = q.from(clazz);

        q.where(cb.qbe(entity, example)); // query by example
        q.select(entity);

        TypedQuery<E> tq = entityManager.createQuery(q);
        return tq.getResultList();
    }

for entities like this

 <at> Entity
 <at> Table(name="APPUSER",uniqueConstraints= <at> UniqueConstraint(columnNames={"username"}))
public class User implements Serializable{
    /**
     *
     */
    private static final long serialVersionUID = 4411272750939441365L;

     <at> Id
     <at> GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
(Continue reading)

Maxim Solodovnik | 27 Jan 19:53 2015
Picon

Huge String DB mapping

Hello All,

I'm trying to map Huge string to the DB:

public static final int MAX_LOG_SIZE = 1 * 1024 * 1024;
 <at> Lob
 <at> Column(name="ful_message", length = MAX_LOG_SIZE)
private String fullMessage;

Unfortunately I get column of type TEXT in my MySQL database :( (64K max)

I tried to remove  <at> Lob annotation, no luck

OpenJPA 2.3.0

Am I doing something wrong? Or it is bug in OpenJPA?

Thanks in advance!

--

-- 
WBR
Maxim aka solomax
zhourui | 1 Jan 05:33 2015
Picon

how to query list property with criteria query?

have entity like:
 <at> Entity
public class CompanyAttribute extends SliceJpaObject {
	 <at> PersistentCollection(fetch = FetchType.EAGER)
	private List<String> attributeList = new ArrayList<String>();
	......
}

now need to select the List property 'attributeList' only in criteria query,
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<List&lt;String>> cq = cb.createQuery(List<String>.class);

CriteriaQuery<List&lt;String>> cq = cb.createQuery(List<String>.class); is
mistake.
hoe to do it.

thanks!

--
View this message in context: http://openjpa.208410.n2.nabble.com/how-to-query-list-property-with-criteria-query-tp7587532.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Trenton D. Adams | 17 Dec 01:21 2014
Picon

ClassCastException on maven enhancing

Good day,

I have a maven build.  When I run "mvn install" my unit tests run just 
fine, as does the enhancer...
[INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer)  <at>  webdirectory ---
66  athome  INFO   [main] openjpa.Tool - Enhancer running on type 
"ca.tnt.athome.Town".
190  athome  INFO   [main] openjpa.Tool - Enhancer running on type 
"ca.tnt.athome.HouseListing".

But, when I run "mvn install tomcat:deploy", the enhancer plugin tries 
to run again, and this...

[INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer)  <at>  webdirectory ---
An error occurred while attempting to determine the version of 
"file:/home/trenta/LocalDocuments/development/java/athome/web-directory/target/classes/META-INF/persistence.xml".
[INFO] 
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] 
------------------------------------------------------------------------
[INFO] Total time: 9.535 s
[INFO] Finished at: 2014-12-16T17:18:11-07:00
[INFO] Final Memory: 13M/218M
[INFO] 
------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance (enhancer) on project 
webdirectory: Execution enhancer of goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed: 
(Continue reading)

Pinaki Poddar | 12 Dec 20:20 2014
Picon

Re: OpenJPA support for JPA 2.1: when?

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.

jacksmith | 12 Dec 03:26 2014
Picon

OpenJPA generate wrong query when using postgres as DBDictionary

Our application is using OpenJPA 2.2 with Oracle, everything is working fine.

Now we need to move to postgres database, but we run into a basic issue, the
generated query is wrong, it has extra table in the FROM statement which
causes cartesian join.

any help will be deeply appreciated. if you need anything else, please let
me know.

It's also very easy to reproduce the issue, following is the method to
reproduce it:
/**
* with postgres as dbdictionay, this method produces wrong query like (with
oracle it works fine):
* SELECT t1.ORGN_ID FROM V_LOCATION t0 , T_DIM_ORGN t1 WHERE (t1.CLNT_OBJ_ID
= ?) 
* 
* the correct query should be like:
* SELECT t1.ORGN_ID FROM T_DIM_ORGN t1 WHERE (t1.CLNT_OBJ_ID = ?) 
*/
public void getDeptOptionsByUser(String filterId) {

        List<Predicate> predicates = new ArrayList<Predicate>();
	CriteriaBuilder cb = em.getCriteriaBuilder();
	CriteriaQuery<Tuple> cq = cb.createTupleQuery();

	/* the following line is purposely added to reproduce the issue. our real
application code is
	* much more complex and we don't have a way to bypass the issue
	*/
(Continue reading)

Roberto Cortez | 11 Dec 16:44 2014

Re: OpenJPA support for JPA 2.1: when?

Hi,
Forgive me with these very basic questions:
- All the JPA 2.1 work should be done in this svn
sandbox: https://svn.apache.org/repos/asf/openjpa/sandboxes/21?- Should we just pick a task
from the list here: http://openjpa.apache.org/jpa-2.1-tasks.html and contribute to it?- Since
I'm not a committer, should I just send the patches for the code?
Cheers,Roberto  
      From: Rick Curtis <curtisr7@...>
 To: users <users@...> 
Cc: Pinaki Poddar <pinaki.poddar@...> 
 Sent: Thursday, December 11, 2014 3:09 PM
 Subject: Re: OpenJPA support for JPA 2.1: when?

For those that are interested in this development effort, please take a
look at the jpa-2.1 development tasks[1]. There are some low hanging prelim
tasks that need to get taken care of prior to any real 2.1 work happening.

Pinaki -- I see you created a 2.1 development sandbox, do you have any info
on the changes that you've already started to prototype?

Thanks,
Rick

[1] http://openjpa.apache.org/jpa-2.1-tasks.html

On Tue, Dec 9, 2014 at 10:50 PM, David Blevins <david.blevins@...>
wrote:

> On Dec 8, 2014, at 11:55 AM, David Blevins <david.blevins@...>
> wrote:
(Continue reading)

Tester | 30 Nov 16:21 2014
Picon

Set cascading-persist gobally or through ReverseMappingTool

Dear OpenJPA community,

I use the OpenJPA ReverseMappingTool to programmatically create my
entities. The issues that I'm now encountering is the following error
message:

Suggested actions: a) Set the cascade attribute for this field to
CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or "persist" or
"all" (JPA orm.xml),
 b) enable cascade-persist globally,
 c) ...

I see 3 possible solutions to change the CascadingType to Persist (the
ReverseMappingTool puts CascadinType.Merge by default it seems):
1) Pass a configuration to the ReverseMappingTool to add
CascadingType.Persist instead of the default CascadingType.Merge

=> I have been looking in the docs of the ReverseMappingTool, but I cannot
find a way to set it. Am I overlooking something?
2) Set CascadingType.Persist globally in a programmatic way.

=> I looked to add it through the JDBCConfiguration/OpenJPAConfiguration or
EntityManager, but here I still don't see way to set this globally
3) Manipulate the generated entity files. This is definitely possible, but
I would prefer option 1 or 2.

Anybody has an idea on how to achieve point 1 or 2?

Kind regards,
(Continue reading)


Gmane