Let's say we have an entity
@Entity
public class Person {
@Id int id;
@Basic String name;
@Basic String remark;
}
Let's say "remark" field is filled with big texts, but rarely used. So it would be good if when you run jpql: SELECT p FROM Person p, EclipseLink just executes sql select id, name from person
And than when you...
I'm looking for a way in EclipseLink to have two @DiscriminatorColumns on the same entity
My PostreSQL DB table is:
Dictionary
{
id,
object_type,
attribute_type,
translation
}
And classes are:
@Entity
@Table(name = "dictionary")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="object_type",
...
I have the following two annotated classes that I use to build a graph:
@Entity
@Table(name = "Edge")
public class Edge
{
/* some code omitted for brevity */
@ManyToOne
@JoinColumn(name = "ixNodeFrom", nullable = false)
private Node _nodFrom;
@ManyToOne
@JoinColumn(name = "ixNodeTo", nullable = false)
...
Hi all.
We have a project with some special requirements, one of wich is getting data from a XMLType database column from an Oracle 10g database.
We have found an easy solution using JDBC, but it would drive the application a little messy, as all the data access is being done through JPA (the implementation used is EclipseLink).
We ha...
Hello,
I have a simple class CustomQuoteRequest:
public class CustomQuoteRequest {
private String requestId;
private String currencyPairCode;
public String getRequestId() {
return requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public String getCurrencyPairCode() {
r...
Hi
I've just started working on web services using JAXB to unmarshall the incoming SOAP documents to our domain classes. I've run into a technical challenge, which is dictated by the OIO XML format used within danish govermental institutions. The format states among other things, that it is not allowed to use the xml schema attribute n...
My domain model in my Java EE 6 application contains bi-directional relationships like the following:
@Entity
public class Users implements PrimaryKeyHolder<String>, Serializable {
@Id
private String username;
@ManyToMany(mappedBy= "users")
private List<Category> categories;
public List<Category> getCategories() {
if (c...
When I execute:
public void beginTransaction() {
em.getTransaction().begin();
}
following an active transaction started in the same way, I get the following exception:
Exception Description: Transaction is currently active
java.lang.IllegalStateException:
Exception Description: Transaction is currently active
at ...
I am trying to do a simple persistence with jpa 2.0 and derby but I keep getting a NullPointerException.
Exception and entity class - http://pastebin.com/QqXhRdcN
The code where I am trying to persist
EntityManager em = emf.createEntityManager();
Course c = new Course("cse", 214, "fall", 2010);
em.getTransaction().begin();
...
Using the EclipseLink JPA2 implementation (not sure if it's the same with the Hibernate implementation)
I have a simple structure where an Organization entity has contracts. Here's the sql I exported from postgres to create the Organization
CREATE TABLE organization (
key bigint NOT NULL,
version integer
);
If I specify the...
Hi,
I'm currently trying to implement a ManyToMany Relationship with Data in the JoinTable.
I'm following this approach with the Eclipselink JPA Framework.
But I'm getting the following exception:
org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:210)
... 23 more
...
Hi guys,
I have classes on my domain model with plenty of lazy relationships; I was using server-side state saving with JSF, and that allowed me to have these lazy mappings initialized on-demand by the presentation layer.
But switching to client-side state saving, I have an exception from EclipseLink, telling me that it could not seria...
EclipseLink normally generates SQLs like:
SELECT t0.ID, t1.NAME FROM MAN t0, WIFE t1 WHERE t0.ID = t1.MAN_ID
Is it possible to tell EclipseLink, that it should use full table names for aliases to make the query more readable?
SELECT t0_MAN.ID, t1_WIFE.NAME FROM MAN t0_MAN, WIFE t1_WIFE WHERE t0_MAN.ID = t1_WIFE.MAN_ID
I think Hiber...
My current persistence.xml table generation strategy is set to create. This guarantees that each new installation of my application will get the tables, but that also means that everytime the application it's started logs are polluted with exceptions of eclipselink trying to create tables that already exist.
The strategy I wish is that t...
I've just noticed that for my entity's id, eclipselink assigns an id 1 + the previously greated assigned IN THE SAME SESSION (1), as opposed to in the element table (2). This goes against my application expectations.
What's the easiest way to tell it to do 2?
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int objId;
And...
I am using Spring + EclipseLink 2 to manage entity on a Derby database. Select object from db works fine but when I try to persist one, nothing happens. Program executes correctly and no exception are thrown. I probably did something wrong, as I'm not familiar with Spring, thanks for your comments and suggestions :)
The ServerDaoDb meth...
Hey guys, I have the following query and for the life of me I can't seem to translate it into JPQL. The working SQL is:
select * from TB_PRINT_DETAIL y inner join
(select JOB_ID,max(COPY_NUM) MAX_COPY_NUM from TB_PRINT_DETAIL group by JOB_ID ) x
on y.JOB_ID = x.JOB_ID and y.COPY_NUM = x.MAX_COPY_NUM
My feeble attempt at translati...
I'm trying to use a UUID for a primary key using JPA 2 (EclipseLink). I'm using PostgreSQL as the database. I have my entity declared as follows: I have an Employee table with its PK set as a UUID. I have a JPA Entity mapping to the employee table, which looks like this:
@Entity
public class Employee {
@Id
private String id;
...
Given the following example (departments - projects):
A department has the following properties (composite primary key):
@Entity
@IdClass(DeptId.class)
public class Department
{
@Id
@Column(name="number")
private Integer number;
@Id
@Column(name="country")
private String country;
@Column(name="name")
p...