zhourui | 27 Apr 15:31 2015
Picon

how to use orderBy clause in tuple query?

[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R
<openjpa-2.2.3-SNAPSHOT-r422266:1595313 nonfatal user error>
org.apache.openjpa.persistence.InvalidStateException:
使用过滤器“null”对候选类型“javax.persistence.criteria”执行了此查询,包括将多个查询的结果合并在内存中。您已选择对“”上的结果进行排序,但尚未在
setResult() 子句中选择此数据。请将此排序数据包含在 setResult()
中,以便 OpenJPA 可以抽取此数据以进行内存中排序。
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.getOrderingValue(ExpressionStoreQuery.java:837)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.kernel.OrderingMergedResultObjectProvider.getOrderingValue(OrderingMergedResultObjectProvider.java:62)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.lib.rop.MergedResultObjectProvider.next(MergedResultObjectProvider.java:172)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.kernel.QueryImpl$PackingResultObjectProvider.next(QueryImpl.java:2087)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:35)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1251)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1007)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.slice.DistributedQueryImpl.execute(DistributedQueryImpl.java:61)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
[15-4-27 21:18:26:952 CST] 000000d7 SystemErr     R 	at
org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:286)
(Continue reading)

Marco de Booij | 26 Apr 17:57 2015
Picon

Mapping a Join Table with Additional Columns

I use Tomee 1.7.1 with openjpa version 
openjpa-2.4.0-nonfinal-1598334-r422266.

I have an entity auteurs and an entity boek. They have a ManyToMany 
relation through the entity auteurs_boeken. In this entity there is a 
field type to define the type of the relation (writer, illustrations, 
...). I followed the 
https://en.wikibooks.org/wiki/Java_Persistence/ManyToMany page and came 
up with the following classes (left out all constructors, getters, and 
setters):

=====
 <at> Entity
 <at> Table(name="AUTEURS", schema="BYBLOS")
public class AuteurDto
     extends Dto implements Comparable<AuteurDto>, Cloneable {
   private static final  long  serialVersionUID  = 1L;

    <at> Id
    <at> GeneratedValue(strategy=GenerationType.IDENTITY)
    <at> Column(name="AUTEUR_ID", nullable=false, unique=true)
   private Long    auteurId;
    <at> Column(name="NAAM", length=100, nullable=false)
   private String  naam;
    <at> Column(name="VOORNAAM", length=100)
   private String  voornaam;

    <at> OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, 
mappedBy="auteur")
   private List<AuteurBoekDto> boeken;
(Continue reading)

Henno Vermeulen | 23 Apr 11:48 2015
Picon

criteria API generates a parameter for literal in group by but does not provide the value

Hello,

I have a query created using the criteria API where I group by an expression that contains a small
calculation using literal values.

OpenJPA generates the correct SQL but does not provide the value of the generated parameter in the group by
clause. The query fails with a SQL exception "The value is not set for the parameter number 9.".

I can reproduce the issue with a minimal example. Suppose we have a person class with integer age and length
columns and we wish to select the average length grouped by the person's age / 10:

                        CriteriaBuilder cb = em.getCriteriaBuilder();
                        CriteriaQuery<Double> query = cb.createQuery(Double.class);
                        Root<Person> person = query.from(Person.class);

                        Expression<Double> averageLength = cb.avg(person.<Integer> get("length"));
                        CriteriaQuery<Double> select = query.select(averageLength);

                        select.groupBy(cb.quot(person.<Integer> get("age"), cb.literal(10)));
                        // optional where, useful to ensure parameters are logged
                        select.where(cb.gt(person.<Integer> get("age"), cb.literal(20)));

                        System.out.println("result: " + em.createQuery(query).getResultList());

Whe running this query with trace and displaying parameters on I get:

1067  testPU  TRACE  [main] openjpa.Query - Executing query: Query:
org.apache.openjpa.kernel.QueryImpl <at> be4f81; candidate class: class entities.Person; query: null
1108  testPU  TRACE  [main] openjpa.jdbc.SQL - <t 5763249, conn 7326702> executing prepstmnt 26531336
SELECT AVG(t0.length) FROM Person t0 WHERE (t0.age > ?) GROUP BY (t0.age / ?) [params=(int) 20]
(Continue reading)

Mark Struberg | 19 Apr 17:03 2015
Picon

[VOTE] Release Apache OpenJPA-2.4.0

It’s a great pleasure to call a VOTE for releasing Apache OpenJPA-2.4.0.

OpenJPA-2.4.0 implements the JPA-2.0 specification.

The staging repository can be found here:
https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/

The Release Notes can be found in the file openjpa-project/RELEASE_NOTES.html and online under:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310351&version=12325298

The SVN source TAG is (1674626):
https://svn.apache.org/repos/asf/openjpa/tags/openjpa-parent-2.4.0/

The source release can be found here:
https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/openjpa-parent/2.4.0/openjpa-parent-2.4.0-source-release.zip

The binary release is here:
https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/apache-openjpa/2.4.0/apache-openjpa-2.4.0-binary.zip

My Key can be found here 
https://svn.apache.org/repos/asf/openjpa/KEYS

The VOTE will be open for 72 hours.
[+1] approve
[+0] meh, don’t care
[-1] stop, I’ve found a ${fish} in there

txs and LieGrue,
your OpenJPA team
(Continue reading)

Rashmi Maheshwari | 15 Apr 13:02 2015
Picon

http://openjpa.208410.n2.nabble.com/jira-Created-OPENJPA-2577-In-what-case-code-17041-state-99999-SQLException-returns-during-lazy-fetch-tp7587927.html

Hi friends,

I am facing issue listed on below link.
http://openjpa.208410.n2.nabble.com/jira-Created-OPENJPA-2577-In-what-case-code-17041-state-99999-SQLException-returns-during-lazy-fetch-tp7587927.html

I want to reproduce the issue. Please suggest in what scenarios this type of exception comes.

Regards,
RAshmi
________________________________
ATTENTION: This e-mail may contain confidential information that is intended solely for the addressee.
If you are not the intended recipient, you should delete this message and are hereby notified that any
disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited.
Raimund Klein | 14 Apr 13:30 2015

Occasional IllegalArgumentException (Illegal Capacity) inside ManagedCache

Hi all,

 

We are using OpenJPA 2.2.0 as part of our JBoss Fuse installation. Every couple of months we run into a stack trace such as this one:

 

Caused by: <openjpa-2.2.0-r422266:1244990 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: Illegal Capacity: -12
at org.apache.openjpa.kernel.BrokerImpl.detachAll(BrokerImpl.java:3407)
at org.apache.openjpa.kernel.DelegatingBroker.detachAll(DelegatingBroker.java:1206)
at org.apache.openjpa.persistence.EntityManagerImpl.clear(EntityManagerImpl.java:1169)
at org.apache.aries.jpa.container.impl.EntityManagerWrapper.clear(EntityManagerWrapper.java:49)
at org.apache.aries.jpa.container.context.transaction.impl.SynchronizedEntityManagerWrapper.clear(SynchronizedEntityManagerWrapper.java:113)
at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.createNamedQuery(JTAEntityManager.java:315)
[…]

... 90 more
Caused by: java.lang.IllegalArgumentException: Illegal Capacity: -12
at java.util.ArrayList.<init>(ArrayList.java:142)[:1.7.0_55]
at org.apache.openjpa.kernel.ManagedCache.copy(ManagedCache.java:259)
at org.apache.openjpa.kernel.BrokerImpl.getManagedStates(BrokerImpl.java:4054)
at org.apache.openjpa.kernel.BrokerImpl.detachAllInternal(BrokerImpl.java:3418)
at org.apache.openjpa.kernel.BrokerImpl.detachAll(BrokerImpl.java:3403)
... 101 more

 

Once this has occurred, the only way to recovery is a platform restart.

 

Our impression is that this is a multithreading issue inside OpenJPA. Hoping for the best, we’ve upgraded to 2.2.2 just now and will test with this one, but I’d just like to know if anyone has encountered this before and maybe can help us with an idea what’s going here? We scanned the recent release notes, but haven’t found anything like this mentioned.

 

 

Kind regards

 

Raimund Klein
Technical Architect

t. +44 (0)203 657 0481
raimund.klein-yWYmY0Th08dbaj9gzE0k7wC/G2K4zDHf@public.gmane.org

 


www.monitisegroup.com

 



This message contains confidential and proprietary information of the sender, and is intended only for the person(s) to whom it is addressed. Any use, distribution, copying, disclosure or taking of any action in reliance upon it by any other person is strictly prohibited. If you have received this message in error, please notify the e-mail sender immediately, and delete the original message without making a copy. Monitise accepts no liability if this email harms any systems or data of the recipient (including as a result of software virus infection or where this e-mail is modified or amended in any way during or following transmission) or if this email is accessed by anyone other than the person(s) to whom it is addressed.

The Monitise group includes Monitise plc (Reg. No. 6011822), Monitise Group Limited (Reg. No. 5590897), Monitise International Limited (Reg. No. 5556711), Monitise Europe Limited (Reg. No. 4831976) and Mobile Money Network Limited (Reg. No. 7153130). These companies are registered in England and Wales and their registered office address is 95 Gresham Street, London, EC2V 7NA United Kingdom.


This email message has been delivered safely and archived online by Mimecast.
For more information please visit http://www.mimecast.com
David Goodenough | 6 Apr 11:15 2015

Which version of JPA (2.0 or 2.1) does openjpa 2.4 support?

According to:-

http://openjpa.apache.org/jpa-2.1-development-process.html

openjpa 2.4 is the release that should implement JPA 2.1.  But I am told
on the tomee mailing list that although tomee 2.0 included an
openjpa 2.4 snapshot it does not support jpa 2.1.

I am confused, can someone enlighten me.

David

Hal Hildebrand | 28 Mar 00:28 2015

OpenJPA PostgreSQL UUID column

Attachment (UuidValueHandler.java): application/octet-stream, 2111 bytes


I’m trying to use the native UUID type for PostgreSQL in my OpenJPA model.  I’m using OpenJPA 2.3.0 and at the current level of the PostgreSQL JDBC driver.

I’ve tried to accomplish this several times and I’ve gotten a bit further this time.  I created a ValueHolder (see attached file) and it does what I believe is the correct setup for this type.  I use this as the strategy for the column - i.e. :

<at> Strategy("com.chiralbehaviors.CoRE.openjpa.UuidValueHandler")

I’ve validated via breakpoint that the UuidValueHolder is indeed called in setup and when converting values.  I’m at the point of trying to do an insert, and regardless of whether I use an actual UUID as the return mapping (i.e. no transform) or a string (UUID.toString()) I get the same error:

ERROR: column "id" is of type uuid but expression is of type bytea
  Hint: You will need to rewrite or cast the expression.
  Position: 93 {prepstmnt 1848199707 
INSERT INTO ruleform.agency (id, notes, update_date, description, name, 
        updated_by) 
    VALUES (?, ?, ?, ?, ?, ?) 
[params=(byte[]) [B <at> 9ac8b5b, (null) null, (Timestamp) 2015-03-27 15:20:05.921, (null) null, (String) CoRE, (byte[]) [B <at> 15b17c95]} [code=0, state=42804]

I believe that this error comes from the postgres jdbc driver, not openJPA.  I’ve even tried using PGObject, which surprisingly works just fine, but throws the same error.

In my google searches, this has come across as a typical problem, and I’ve only found solutions for this (hypothesized) for Toplink and Hibernate.  The one thing I could find suggested writing the ValueHolder and that does work up until the point I try to actually insert in JDBC land.

Note that the UUID is being passed as a byte array.

So my question is, am I doing anything incorrect?  Missing something?  From the error message, it would appear postgresql wants me to cast the result, but I’m not sure how to accomplish that in OpenJPA.  It could simply be a red herring.

Any help appreciated, as I simply can’t find a working solution via Der Google

-Hal
sia | 17 Mar 23:55 2015
Picon

Forcing an outer join in many-to-one relations with order by column

Hello All:

I was wondering if someone can help me with this issue. I have been reading/searching the forum with no avail
as well all over the web. I have an entity as follows:

 <at> Entity
 <at> Table(name = "REQUEST")
public class Request {

 <at> ManyToOne(fetch = FetchType.EAGER)
     <at> JoinColumn(name = "SLOT_ID", referencedColumnName = "SLOT_ID")
    private Asset slot;

.....
}

Running the following query cause a left outer join with my relation : 

Select r from Request r;

However; if I run

Select r from Request r ORDER BY r.slot.name

this would generate an inner join.

I would like to force an outer join at all times at the entity level. I have looked into writing a custom
strategy by extending RelationFieldStrategy; however, I see only addFetchInnerJoin in
JDBCFetchConfiguration class when I try to override

public void selectEagerJoin(Select sel, OpenJPAStateManager sm,
                            JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode)

Can someone kindly give me a hint if this is possible or I have to extend a different class or some how set the
fetch mode to OUTER JOIN in my entity.
 		 	   		  
Henno Vermeulen | 9 Mar 09:52 2015
Picon

Java 8/Java 7 end of life

Hello,

AFAIK, OpenJPA still doesn't work with Java 8. Are there any plans of fixing this soon? Perhaps OpenJPA
committers could give this some more priority?

Oracle public support for Java 7 will end after April this year, see http://www.oracle.com/technetwork/java/javase/eol-135779.html
If I understand well, this means that security issues in Oracle's Java 7 runtime will no longer be fixed so
that an application using OpenJPA on Java 7 will become more and more vulnerable over time.

The ticket for Java 8 was last updated in October 2014: https://issues.apache.org/jira/browse/OPENJPA-2386

Regards,
Henno Vermeulen
Craig Taylor | 6 Mar 22:44 2015
Picon

Dynamic POJO population and child POJOs with CriterionQuery

We've built up a filter library on top of OpenJPA CriteronQuery is fairly
dynamic allowing population of a number of parameters and currently returns
the associated Entity objects correctly.

For a large majority of the web service calls however, the entity
association as well as the additional overhead retrievals are un-necessary
as we're directly populating the data into a DTO and returning it.  The
DTOs do not always map to the Entity objects being returned.

I've been able to modify the library to correctly populate a shallow (No
List<OtherClass> etc) pojo DTO by making use of an array of Selection<>
objects.

I'd like to support the ability to populate fields of child memebers. Eg,
given:

ParentDTO  {
    List<ChildDTO> childDTO; // associated set/getChildDTO, addChildDTO
}

ChildDTO {
   Integer id; String firstName; String lastName; String city
}

I'm not sure how to define the individual elements of the ChildDTO?

Should the child be mapped in the parent as a CompundSelection<>{
Selection<Integer> idPath, Selection<String> firstName } in the parent
selection list?   Would this return me v List<Object[]> result set an array
of the corresponding child fields?

The construct() method looks interesting but I've been unable to see how I
can bend it to my will.  Is it tied to an entity object or can I map it to
individual POJO's and only for certain elements while handling child
objects selectively also?

Thanks,

--

-- 
-------------------------------------------
Craig Taylor
ctalkobt@...

Gmane