jpa-2.0

Issue in deploying JBPM 5.4 console server war on Websphere application server with JPA2 feature pack to use oracle database

家住魔仙堡 提交于 2020-01-16 12:36:10
问题 Facing issue in deploying JBPM 5.4 console server war to use oracle database. Please find below the stacktrace. [10/31/13 19:17:01:295 IST] 00000009 JPAPUnitInfo E CWWJP0015E: An error occurred in the org.hibernate.ejb.HibernatePersistence persistence provider when it attempted to create the container entity manager factory for the org.jbpm.persistence.jpa persistence unit. The following error occurred: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory [10/31/13

JPA Entity mapping for join columns

瘦欲@ 提交于 2020-01-16 08:59:13
问题 I have three tables EmployeeDepartment, EmployeeGroup and EmpplyeeDetails Table. EmployeeDepartment table has primary key departmentId and a column groupId, EmployeeGroupTable has primary key groupid which should be generated from databse sequence GroupIdGenerator. EmployeeDetails have two primary keys as groupid and employeeid. Groupid should be same as of the previous table These values in all table should insert in one transaction. Can you help me with correct JAP Entity mapping? I already

Usage of cascade=cascadeType and fetch = FetchType

谁都会走 提交于 2020-01-16 04:25:05
问题 I am using JPA 2. I would like to know the following. What is the best approach to restrict insert, update or delete when parent key does not exist in parent table. I have the following Entity scenario @Entity public class Employee { @OneToMany(mappedBy = "requester") private Set<Project> requestedProjects; @OneToMany(mappedBy = "approver") private Set<Project> approvedProjects; } @Entity public class Project @ManyToOne @JoinColumn(name = "EMPLOYEE_NUMBER", referencedColumnName = "EMPLOYEE

TypedQuery equivalent for JPA 1.0

ⅰ亾dé卋堺 提交于 2020-01-16 03:23:54
问题 I am quite new to JPA and I am using Apress JPA2 text book to learn it. I was trying to do the first example from the book. This following line of code gives me an error: TypedQuery query = em.createQuery("SELECT e FROM Employee e", Employee.class); saying that TypedQuery cannot be resolved to a type. After struggling for sometime I realised that I am using JPA version 1 which does not contain TypedQuery but just Query interface. My question is whether there is an equivalent statement in JPA

TypedQuery equivalent for JPA 1.0

☆樱花仙子☆ 提交于 2020-01-16 03:23:19
问题 I am quite new to JPA and I am using Apress JPA2 text book to learn it. I was trying to do the first example from the book. This following line of code gives me an error: TypedQuery query = em.createQuery("SELECT e FROM Employee e", Employee.class); saying that TypedQuery cannot be resolved to a type. After struggling for sometime I realised that I am using JPA version 1 which does not contain TypedQuery but just Query interface. My question is whether there is an equivalent statement in JPA

How to map this OnetoOne in hibernate using JPA

∥☆過路亽.° 提交于 2020-01-16 01:47:26
问题 Merged with Referential integrity with One to One using hibernate. I have following Entity - @Entity public class Foo { @Id private Long id; @OneToOne(cascade = CascadeType.ALL, mappedBy = "foo") private Bar bar; // getters/setters omitted } @Entity public class Bar{ @id private Long id; @OneToOne @JoinColumn(name = "foo_id", nullable = false) private Foo foo; // getters/setters omitted } I kept the relation like this because I want to keep the Id of Foo in Bar table so I can have delete

JPA 2 + EclipseLink : Caching Issue

只愿长相守 提交于 2020-01-15 10:57:19
问题 I have a strange behavior with caching and JPA Entities (EclipseLink 2.4.1 ) + GUICE PERSIST I will not use caching, nevertheless I get randomly an old instance that has already changed in MySQL database. I have tried the following: Add @ Cacheable (false) to the JPA Entity. Disable Cache properties in the persistence.xml file : <class>MyEntity</class> <shared-cache-mode>NONE</shared-cache-mode> <properties> <property name="eclipselink.cache.shared.default" value="false"/> <property name=

JPA 2 + EclipseLink : Caching Issue

拜拜、爱过 提交于 2020-01-15 10:57:05
问题 I have a strange behavior with caching and JPA Entities (EclipseLink 2.4.1 ) + GUICE PERSIST I will not use caching, nevertheless I get randomly an old instance that has already changed in MySQL database. I have tried the following: Add @ Cacheable (false) to the JPA Entity. Disable Cache properties in the persistence.xml file : <class>MyEntity</class> <shared-cache-mode>NONE</shared-cache-mode> <properties> <property name="eclipselink.cache.shared.default" value="false"/> <property name=

MyISAM dialect generates wrong DDL

岁酱吖の 提交于 2020-01-14 14:57:47
问题 We use the MyISAM dialect org.hibernate.dialect.MySQLMyISAMDialect to auto generate DDL files based on JPA2 using 3.6.9.Final hibernate provider on a MySQL 5.5 database. The create SQL file gets generated as CREATE TABLE t (i INT) type = MYISAM; instead of CREATE TABLE t (i INT) ENGINE = MYISAM; which causes table creation to fail. Note: This worked fine in 5.1 and lesser versions. What hibernate provider should I use to get this fixed. 回答1: It is broken, MySQL dropped support for deprecated

criteria api--root.fectch() how to fetch a collection?

微笑、不失礼 提交于 2020-01-14 13:46:34
问题 The args' type of method fetch() can be SingularAttribute, PluralAttribute, why not can't be ListAttribute ? Then, how to fetch a collection with critria api ? Thank you. 回答1: Of course it can, as Rasmus Franke said. Just check from the javadocs for FetchParent or try this: @Entity public class SomeEntity { @Id int id; @OneToMany List<OtherEntity> others; } @Entity public class OtherEntity { @Id int id; } CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<SomeEntity> cq = cb