eclipselink

Automatically creating and/or extending JPA tables with Wildfly, EclipseLink and Postgres

戏子无情 提交于 2019-12-13 08:21:13
问题 I have experienced a strange matter with a Java EE application running on Wildfly 8.1.0 as the server and Postgres as our database system in combination with EclipseLink as the persistence provider (the reasons why I want to study the costs of migrating from built-in Hibernate to EclipseLink don't matter here) . I was getting used to the Hibernate feature of automatically extending the existing database tables by newly added columns when extending the corresponding Entity classes and it would

@MappedSuperclass static weaving with EclipseLink and multiple jars

…衆ロ難τιáo~ 提交于 2019-12-13 07:31:18
问题 My entities objects are scattered in multiple jars. In jar A I have a base class name MyBase which is annotated with @MappedSuperclass. In jar B there is an entity class which derives from MyBase. The problem is that because the weaving is done in the context of the jar file (I'm using the maven plugin) the base class (MyBase) isn't instrumented (although it should). If I move the derived class from jar B to A then the weaving process will handle the base as well. Since I'm working on a large

Criteria Query select join

倾然丶 夕夏残阳落幕 提交于 2019-12-13 07:14:03
问题 I need help to convert this JPQL query in Criteria Query: SELECT u.documentList FROM Unit u WHERE u.id = :id this is what i have tried: CriteriaQuery<Document> query = builder.createQuery(Document.class); Root<Unit> root = query.from(Unit.class); Join<Unit, Document> join = root.join(Unit_.documentList); query.select(join); query.where(builder.equal(root.get(AbstractEntity_.id), entity.getId())); executing this query result in a complex SQL query that returns an empty list. IMO this should

How to set up Eclipselink cache coordination with Wildfly

时间秒杀一切 提交于 2019-12-13 06:53:57
问题 I have set up a persistancce caching with Eclipselink on Wildfly 8. It works, but I also want to do cache coordination. I have the following setup for Eclipselink cache coordination in my persistance.xml: <property name="eclipselink.cache.coordination.protocol" value="jms" /> <property name="eclipselink.cache.coordination.jms.topic" value="jms/MemberTopic" /> <property name="eclipselink.cache.coordination.jms.factory" value="jms/MemberConnectionFactory" /> However, when my entity is merged,

Is it necessary to remove an entity from the collection on the inverse side, if its parent's reference is set to null in the entity while merging?

好久不见. 提交于 2019-12-13 06:36:06
问题 Inverse side (Department) : @OneToMany(mappedBy = "department", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) private List<Employee> employeeList = new ArrayList<Employee>(0); Owning side (Employee) : @JoinColumn(name = "department_id", referencedColumnName = "department_id") @ManyToOne(fetch = FetchType.LAZY) private Department department; The method that merges an Employee entity supplied by a client having a null Department in it : public Employee update(Employee

JPA - OneToMany relationship not loading children

拟墨画扇 提交于 2019-12-13 06:26:04
问题 I am trying to configure this @OneToMany and @ManyToOne relationship but it's simply not working, not sure why. I have done this before on other projects but somehow it's not working with my current configuration, here's the code: public class Parent { @OneToMany(mappedBy = "ex", fetch= FetchType.LAZY, cascade=CascadeType.ALL) private List<Child> myChilds; public List<Child> getMyChilds() { return myChilds; } } public class Child { @Id @ManyToOne(fetch=FetchType.LAZY) private Parent ex; @Id

How to use JPA lock?

一笑奈何 提交于 2019-12-13 05:56:03
问题 Yes, I know maybe the question is very wide, but I don't understand how the JPA lock works. I will put an example about how I'm using it: public Account deposit(int id, double quantity) { Account a = super.find(id); if (a == null) { return null; } try { em.lock(a, LockModeType.PESSIMISTIC_WRITE); a.setSaldo(a.getSaldo() + quantity); LOG.log(Level.INFO, " //\u00a0 Se ha depositado, saldo :{0}", a.getSaldo()); } catch (Exception oe) { LOG.log(Level.INFO, oe.getMessage()); } return a; } And you

MySQL Syntax Error by combining CASE and LIMIT (only sometimes) - generated by JPA

北城以北 提交于 2019-12-13 05:50:09
问题 I am working on a JSF-Web-Application with a MySQL-Database and JPA in a Java EE-Context. I am using the following JPQL to get some data from the Database. The EntityGenerierteAufgabe has the fields createTime and changeTime. CreateTime is set when the database entry is written. In this case changeTime is NULL. When the database entry is updated changeTime will also be set. Now I want to select from this table and order the entries bei changeTime, if set, otherwise by createTime. AND I want

Glassfish 4 moxy eclipselink 2.5.2 oxm object graph troubles

让人想犯罪 __ 提交于 2019-12-13 05:15:53
问题 I'm having this issue marshaling with an oxm xml meta data defined object graph Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBElement not found by org.eclipse.persistence.core [142] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl .java:1532) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.jav a:1955)

Could not resolve a persistence unit error - Netbeans 7.3/7.4 and Glassfish 4

大城市里の小女人 提交于 2019-12-13 05:11:03
问题 I've been adapting a code sample from the JSF2.0 Complete Reference textbook (the Virtual Trainer application) to run using CDI. All was going well until I started adding some of the JSF code at which point the deployment began to repeatedly fail stating that it could not resolve a persistence unit. I was somewhat puzzled as I hadn't touched any of my entity code or controller beans but rolled the application back anyway (manually - I didn't have it attached to Subversion a the time). Despite