Questions tagged [openjpa]

OpenJPA is an open source implementation of the Java Persistence API specification. It is an object-relational mapping (ORM) solution for the Java language, which simplifies storing objects in databases. It is open source software distributed under the Apache 2.0 Licence.

OpenJPA is an open source implementation of the Java Persistence API specification similar to and . It is an object-relational mapping (ORM) solution for the Java language, which simplifies storing objects in databases. It is open source software distributed under the Apache 2.0 Licence.

The project is an official Apache projectand is available at http://openjpa.apache.org/

Useful links

Related tags

1089 questions
94
votes
5 answers

What is referencedColumnName used for in JPA?

In JPA there is an attribute called referencedColumnName that can be set on @JoinColumn, @PrimaryKeyJoinColumn what is the idea behind this setting, can someone give a good example of where this can be used?
ams
  • 60,316
  • 68
  • 200
  • 288
77
votes
12 answers

Can a JPA Query return results as a Java Map?

We are currently building a Map manually based on the two fields that are returned by a named JPA query because JPA 2.1 only provides a getResultList() method: @NamedQuery{name="myQuery",query="select c.name, c.number from Client…
Eddie
  • 9,696
  • 4
  • 45
  • 58
54
votes
5 answers

JPA Criteria builder IN clause query

How to write criteria builder api query for below given JPQL query? I am using JPA 2.2. SELECT * FROM Employee e WHERE e.Parent IN ('John','Raj') ORDER BY e.Parent
Raj
  • 559
  • 1
  • 4
  • 4
35
votes
2 answers

JPA: default column name mapping for @ManyToOne relations

When we have a class: @Entity Order implements Serializable { @Id private Integer id; ... } and: @Entity OrderLine implements Serializable { @Id private Integer id; @ManyToOne Order order; ... } What row name will…
Kdeveloper
  • 13,679
  • 11
  • 41
  • 49
34
votes
3 answers

JPA Implementations - Which one is the best to use?

I have made use of the following JPA implementations: Hibernate, Toplink, OpenJPA Each of them has their own strengths and weaknesses. I found Hibernate the most advanced of the three except that it mixed some of its own enhancements with JPA…
mxc
  • 983
  • 3
  • 10
  • 17
33
votes
4 answers

To initialize or not initialize JPA relationship mappings?

In one to many JPA associations is it considered a best practice to initialize relationships to empty collections? For example. @Entity public class Order { @Id private Integer id; // should the line items be initialized with an empty…
ams
  • 60,316
  • 68
  • 200
  • 288
29
votes
2 answers

OpenJPA criteriaBuilder nested object property fetch

Is there any way in OpenJPA to get hold of a nested object property via CriteriaBuilder? Here's a small case. @Entity public class X { private Object Y; // getters, setters... } @Entity public class Y { private String Z; …
quantum
  • 3,000
  • 5
  • 41
  • 56
27
votes
3 answers

JPA/Hibernate bulk(batch) insert

Here is simple example I've created after reading several topics about jpa bulk inserts, I have 2 persistent objects User, and Site. One user could have many site, so we have one to many relations here. Suppose I want to create user and create/link…
Andriy Kopachevskyy
  • 7,276
  • 10
  • 47
  • 56
18
votes
2 answers

selecting all rows from a database using JPA in WebSphere

I am trying to implement a web service that uses open JPA to access the data layer. I am using websphere v7.0 and JPA 2.0. This service is going to get all rows out of a small db (about 6 rows and it won't expand much at all in the future). I am…
SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195
15
votes
3 answers

updating multiple rows using JPA

I want to update all fields of a table that has value of colum NAME as 'PCNAME'. The table name which i want to update is XYZ.I want to update only some fields and not keep some unchanged. This will affect many rows and not a single row as there…
akp
  • 1,823
  • 7
  • 26
  • 29
14
votes
3 answers

JPA: which implementations support lazy loading outside transactions?

EclipseLink can load lazy relationships in entities even after the entity manager that has created them is no longer available. With Hibernate this doesn't work, or at least didn't at the time of that post. What about other providers? OpenJPA and…
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
13
votes
2 answers

Database sharding and JPA

I am working on a Java application that requires horizontal partitioning of data in different PostgreSQL servers. I would like to use a JPA framework and Spring for transaction management. The most popular frameworks for sharding data with JPA seem…
is-serp
  • 171
  • 1
  • 9
13
votes
5 answers

How do I configure OpenJPA SQL logging?

What is the OpenJPA configuration to view SQL query executed in a database? I would like to view the query with all parameters executed in log or console instead of viewing the JPQL query
user1400965
  • 151
  • 1
  • 1
  • 5
12
votes
3 answers

How do you send back a subset of a JPA entity that is owned by another entity?

I have an entity that owns another entity: //psuedocode public class ClassA{ private String name; @OneToOne private ClassB classb; } public class ClassB{ private String thing1; private String thing2; private String…
GuitarStrum
  • 713
  • 8
  • 24
11
votes
2 answers

How to define null-handling in Spring Data JPA sorts?

I need my data to be ordered by null and not null only. Like below: Column A null null null 8 10 5 Meaning once all the null values are on top, the rest of the values should not be sorted at all and come as is. Any idea how this can be done…
Priyabrat Nanda
  • 1,095
  • 3
  • 18
  • 34
1
2 3
72 73