eclipselink

Disable eclipselink caching and query caching - not working?

此生再无相见时 提交于 2019-12-11 01:23:54
问题 I am using eclipselink JPA with a database which is also being updated externally to my application. For that reason there are tables I want to query every few seconds. I can't get this to work even when I try to disable the cache and query cache. For example: EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("default"); EntityManager em = entityManagerFactory.createEntityManager(); MyLocation one = em.createNamedQuery("MyLocation.findMyLoc").getResultList()

EclipseLink+SpringDataJPA: Single Table MultiTenancy-TENANT_ID is not added to WHERE clause for DELETE and UPDATE

﹥>﹥吖頭↗ 提交于 2019-12-11 01:17:14
问题 I am using EclipseLink And Spring Data JPA for Single Table Multi-Tenancy.(DISCRIMINATOR based model). I have customized Spring Data JPA SimpleJPAReposity to add below mentioned and required property on EntityManager . em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT,"TENANT_1"); Every Spring Data JPA operations are now handled by CustomizedSimpleJpaRepository . I have configured it successfully and below all Spring DATA JPA operations are working fine, they are

Eclipselink generated canonical metamodel doesn't extend base metamodel from another jar

爱⌒轻易说出口 提交于 2019-12-11 01:09:24
问题 I created two Maven projects using Netbeans 8.0.1 to illustrate a problem: common1 and common2 (jars). common1: package pck1 @MappedSuperclass public class Entity1 implements Serializable { @Basic(optional = false) @Column(name = "val") protected String val; } package pck2 @Entity @Table(name = "entity2") public class Entity2 extends Entity1 { @Id private Long id; public Long getId() { return id; } public void setId(Long id) { this.id = id; } } persistence.xml <?xml version="1.0" encoding=

How do I get EclipseLink JAXB (MOXy) to not display namespaces in XML output

允我心安 提交于 2019-12-10 22:54:22
问题 I'm trying to move from the JAXB reference implementation to EclipseLink JAXB (MOXy) because it appears to solve JAXB outputting invalid XML when data contains non-displayable chars but I have a problem with it displaying namespace tags. This is how I create a JAXBContext return JAXBContext.newInstance("org.musicbrainz.mmd2"); and this is the output I get <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <metadata created="2013-02-27T12:12:13.305Z" xmlns="http://musicbrainz.org/ns/mmd-2

How to enable static weaving in eclipseLink with remote persistence.xml using Maven?

两盒软妹~` 提交于 2019-12-10 22:44:54
问题 I have a separate jar which contains the persistence.xml. This jar has been added as a dependency in the parent pom of the jar which has the entities. I want to enable static weaving. According to EclipseLink documentation, I can specify the persistenceXMLLocation as a configuration. However, should this location be an absolute file path of my persistence.xml or its path in a repository. Also how can I build my entities jar with weaving enabled? What would be the maven command to execute this

Named query when property is an object?

隐身守侯 提交于 2019-12-10 22:38:23
问题 I would like to make this query in JPA: SELECT * FROM `happyDB`.`users` U WHERE U.party_as_user =1 AND U.party_party_id =2 This is working fine, but my problem is that I have Party only as an object, not as an id and I can't make it work. In the Users -entity where I am trying to do the named query I have the following: @JoinColumn(name = "pary_party_id", referencedColumnName = "party_id") @ManyToOne private Party partyId; @Column(name = "party_as_user") private Boolean partyAsUser; I tried

JPA one-to-many unidirectional relationship using a join table

﹥>﹥吖頭↗ 提交于 2019-12-10 21:13:41
问题 I would like to evaluate JPA on an existing project. The database model and the java classes exists and are currently mapped via self generated code. The database model and the java classes do not fit ideally together - but the custom mapping works well. Nevertheless the usage of JPA in general seems worth a try. As you see I am new to JPA and have to do the work with xml configuration. Currently I am working on a one-to-many unidirectional relationship using a join table (please do not

How to enable Eclipselink's static weaving from Gradle

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 20:08:06
问题 I'd like to enable Eclipselink's static weaving for my JPA classes from Gradle. The Eclipselink docs explain how to do this in an Ant task: <target name="define.task" description="New task definition for EclipseLink static weaving"/> <taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask"/> </target> <target name="weaving" description="perform weaving" depends="define.task"> <weave source="c:\myjar.jar" target="c:\wovenmyjar.jar" persistenceinfo="c:

sun.reflect.annotation.TypeNotPresentExceptionProxy exception after adding EntityListeners

a 夏天 提交于 2019-12-10 18:48:19
问题 When an EntityListeners was added to the application using the @EntityListeners(value = {MyEventListener.class}) , got the following crash. It looks an issue with reflection. The application has a custom annotation defined for the same entity. Note that this crash only happens after adding the EntityListeners. If the custom annotation is commented the application will still crash. The weird thing is that the same code will work fine when run through the Netbeans debugger. The getAnnotation()

How do I retrieve only the ID instead of the Entity of an association?

回眸只為那壹抹淺笑 提交于 2019-12-10 18:09:19
问题 I have a class that looks something like this: @Entity public class EdgeInnovation { @Id public long id; @ManyToOne public NodeInnovation destination; @ManyToOne public NodeInnovation origin; } and another one that looks something like this: @Entity public class NodeInnovation { @Id public long id; @OneToOne public EdgeInnovation replacedEdge; } and so each table map to the other, so one entity will refer to other entities that will refer to more entities and so on, so that in the end there