jpa-2.0

JPA 2.0 Implementations comparison : Hibernate 3.5 vs EclipseLink 2 vs OpenJPA 2

会有一股神秘感。 提交于 2020-01-01 04:51:07
问题 What's your choice? Do You have any suggestions and experience? I'm developing an application with Hibernate 3.5 and Spring 3.0 Pros: Good documentation Easy configuration and helpful logs Popularity - wide community Some extensions to JPA Some additional Tools - JBoss Tools for Eclipse, hbm2ddl, generating static metamodel etc... Cons: Bugs! (Sequences, collections etc...) Lots of reatures are doubled with "pure" Hibernate. There's a mess in legacy Hibernate and JPA annotations. I'm

JPA entity with a interface attribute, is it possible?

自闭症网瘾萝莉.ら 提交于 2020-01-01 04:08:06
问题 I have the following entity: @Entity public class TestCaseStep implements JPAEntity<Integer> { ... @Column(name="STEP_NUMBER") private Integer stepNumber; @Enumerated(EnumType.STRING) @Column(name="ACTION") private Action action; **@ManyToOne @JoinColumn(name="connector") private ScriptItem connector;** My attribute ScriptItem is a interface for 3 other classes. Is it possible to configure JPA to set the correct class id in runtime execution? Other resources: public interface ScriptItem {

JPA entity with a interface attribute, is it possible?

天大地大妈咪最大 提交于 2020-01-01 04:08:05
问题 I have the following entity: @Entity public class TestCaseStep implements JPAEntity<Integer> { ... @Column(name="STEP_NUMBER") private Integer stepNumber; @Enumerated(EnumType.STRING) @Column(name="ACTION") private Action action; **@ManyToOne @JoinColumn(name="connector") private ScriptItem connector;** My attribute ScriptItem is a interface for 3 other classes. Is it possible to configure JPA to set the correct class id in runtime execution? Other resources: public interface ScriptItem {

Working example of Hibernate 3.6.2 2nd level caching with JPA2?

时光怂恿深爱的人放手 提交于 2020-01-01 03:01:07
问题 The title obviously states it : I can't make the second-level cache work for JPA2/Hibernate 3.6.3. I've been trying many a hack to make it work. But I'm only succeeding in having the query cache working. Although Hibernate creates the caches (name of the instance), they're ignored. Even misses are not registered. Maybe it's a version incompatibility. I've tried some others with no result. And I don't feel up to the task anymore to try all permutations. :-P I'm asking the question here as some

Hibernate or EclipseLink for JPA? [closed]

孤街醉人 提交于 2019-12-31 17:52:11
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . I was wondering if anyone has experience with the JPA2.0 implementation of any of those frameworks? Especially together with Spring3.x which comes with EclipseLink support. Do you use any of those frameworks and JPA2.0 for production? Any severe issues? 回答1: IMHO It is always

Hibernate or EclipseLink for JPA? [closed]

点点圈 提交于 2019-12-31 17:50:15
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . I was wondering if anyone has experience with the JPA2.0 implementation of any of those frameworks? Especially together with Spring3.x which comes with EclipseLink support. Do you use any of those frameworks and JPA2.0 for production? Any severe issues? 回答1: IMHO It is always

Using a ParameterExpression as part of the In clause

烈酒焚心 提交于 2019-12-31 04:10:16
问题 I would like to use a parameter expression as part of an in clause. I would like to query for a list of Foos that have a Bar that is in a set of Bars. Is this possible? Foo // Join, ManyToOne Bar getBar() Query ParameterExpression<???> barParameter; void setup() { CriteriaBuilder builder = ... CriteriaQuery<Foo> criteria = ... Root<Bar> root = ... barParameter = builder.parameter(???); criteria.where( builder.in(root.get(Foo_.bar)).value(barParameter) ); } List<Foo> query(Set<Bar> bars) {

Using DISTINCT keyword in JPA on individual columns

隐身守侯 提交于 2019-12-31 01:00:18
问题 I am reading some values from a database that is horribly un-normalized (which I can't control). The call retrieves announcements for university departments, and if a user is in multiple departments (which is possible), then the same results are returned multiple times for these users. However, some departments might have different announcements, while some have the same. Is there a way for me to use the DISTINCT keyword in JPA on individual columns? This is what I currently have for the

conversion sql query to jpa

佐手、 提交于 2019-12-30 11:13:12
问题 I have a query SELECT d.name, count(e.id) FROM department d LEFT OUTER JOIN employee e on e.department_id = d.id and e.salary > 5000 and how i can convert this to jpa right now i have: CriteriaQuery<Object[]> criteria = builder.createQuery(Object[].class); Root<Department> root = criteria.from(Department.class); Path<String> name = root.get("name"); Expression<Long> empCount = builder.count(root.get("employees").get("id")); criteria.multiselect(name,empCount); TypedQuery<Object[]> query = em

conversion sql query to jpa

北城以北 提交于 2019-12-30 11:13:04
问题 I have a query SELECT d.name, count(e.id) FROM department d LEFT OUTER JOIN employee e on e.department_id = d.id and e.salary > 5000 and how i can convert this to jpa right now i have: CriteriaQuery<Object[]> criteria = builder.createQuery(Object[].class); Root<Department> root = criteria.from(Department.class); Path<String> name = root.get("name"); Expression<Long> empCount = builder.count(root.get("employees").get("id")); criteria.multiselect(name,empCount); TypedQuery<Object[]> query = em