openjpa

OpenJPA 1 - sequence table not being created

有些话、适合烂在心里 提交于 2019-12-11 02:24:05
问题 I have an entity class with the following annotation on its primary key: @GeneratedValue(strategy = GenerationType.AUTO) . However, when I try to persist an instance of this class, I get com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'OPENJPA_SEQUENCE_TABLE'. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197) The table it's looking for definitely does not exist in the database. The user it's connecting to the database as

Can JPA 2.0 be used without JavaEE 6?

℡╲_俬逩灬. 提交于 2019-12-10 23:13:48
问题 I am using OpenJPA 2.1 (which implements JPA 2.0 ) for a command line utility. I am using classes that are new for JPA 2.0 . My compile target is Java SE 1.6 OpenJPA 2.1 comes with all JPA 2.0 javax.persistence.* interfaces/implementations. Can I claim that my utility has no dependence on JavaEE 6 ? My understanding is that JavaEE 6 is a collection of standards. So it is no different in that respect from any other random set of standards. Hence JavaEE 6 depends on JPA 2.0 , but JPA 2.0 does

JPA SequenceGenerator and GeneratedValue: name / generator property unique only per class?

依然范特西╮ 提交于 2019-12-10 19:35:31
问题 I use JPA + OpenJPA with PostgreSQL as backend RDBMS. The primary keys of my tables usually consist of a SERIAL / BIGSERIAL column. So PostgreSQL automatically generates IDs for new entries ( strategy=GenerationType.IDENTITY ). The annotations of ID property look like this: @Id @SequenceGenerator(name="myseq",sequenceName="foobartable_fooid_seq") @GeneratedValue(generator="myseq",strategy=GenerationType.IDENTITY) My question is: Can I copy and paste this annotations block to several entities,

Column order on OpenJPA

落爺英雄遲暮 提交于 2019-12-10 13:06:04
问题 Is there a way to get the columns in the order they are declared in the Java class, or to specify the order in some other way? I'm using the mapping tool ant task to generate the DDL for my classes in a sql file. 回答1: No, each implementation of JPA is free to arrange the columns in the generated DDL in the order it sees fit, and in general the programmer has no control over this - for example: Hibernate uses alphabetical order, but DataNucleus allows the specification of a column position

I can't start jboss with a JPA issue

徘徊边缘 提交于 2019-12-10 10:39:45
问题 I am migrating from WAS8.5.5 to JBoss EAP6.4. I got an error message as Caused by: org.jboss.modules.ModuleNotFoundException: openjpa:main I created directory as C:\Applications\jboss64\jboss-eap-6.4\modules\system\layers\base\org\apache\openjpa\main I put the openjpa-2.4.1.jar and serp-1.13.1.jar into it along with the module.xml. <?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="org.apache.openjpa"> <resources> <resource-root path="openjpa-2.4.1.jar"/>

How to define null-handling in Spring Data JPA sorts?

点点圈 提交于 2019-12-10 10:15:43
问题 I need my data to be ordered by null and not null only. Like below: Column A null null null 8 10 5 Meaning once all the null values are on top, the rest of the values should not be sorted at all and come as is. Any idea how this can be done using jpa query/ native query. 回答1: Spring Data's Sort object allows you to define: Sort sort = new Sort(new Order(Direction.ASC, "property").nullsLast()); 回答2: Use JPQL and you will be happy. SELET f FROM Foo f ORDER BY f.name NULLS LAST 来源: https:/

JPA 1.0 error: The name is not a recognized entity or identifier. Known entity names: []

◇◆丶佛笑我妖孽 提交于 2019-12-10 07:42:32
问题 I am getting following exception while I try to execute simple JPA 1.0 code. What may be the cause? 5453 DevPQRWDPBSSPersist WARN [P=351601:O=0:CT] openjpa.Enhance - This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "[class com.XYZ.PQR.bss.client.db.data.markerentry, class com.XYZ.PQR.bss.client.db.data.Serviceproduct, class com.XYZ.PQR.bss.client.db.data.Agreementterms, class com.XYZ.PQR

OpenJPA Wrong order for delete of child when deleting parent

眉间皱痕 提交于 2019-12-10 04:11:50
问题 The order of deletes for OpenJPA 2.3.x are happening in the wrong order and I can't figure out why. Given these JPA mappings // grandparent @Entity @Table(name = "three_phase_motor_input") public class ThreePhaseMotorInput implements IThreePhaseMotorInput, Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Version private Integer version; @OneToOne(orphanRemoval = true, cascade = CascadeType.ALL, optional = true, targetEntity = UnapprovedThreePhaseMotor

How to do a timestamp comparison with JPA query?

﹥>﹥吖頭↗ 提交于 2019-12-09 16:11:43
问题 We need to make sure only results within the last 30 days are returned for a JPQL query. An example follows: Date now = new Date(); Timestamp thirtyDaysAgo = new Timestamp(now.getTime() - 86400000*30); Query query = em.createQuery( "SELECT msg FROM Message msg "+ "WHERE msg.targetTime < CURRENT_TIMESTAMP AND msg.targetTime > {ts, '"+thirtyDaysAgo+"'}"); List result = query.getResultList(); Here is the error we receive: <openjpa-1.2.3-SNAPSHOT-r422266:907835 nonfatal user error> org.apache

Error while updating data using Springboot data rest and OpenJPA

雨燕双飞 提交于 2019-12-08 21:07:31
I am working on Springboot data rest with OpenJPA application, but getting the below exception: RepositoryRestExceptionHandler : Cannot cast org.apache.openjpa.util.LongId to java.lang.Long java.lang.ClassCastException: Cannot cast org.apache.openjpa.util.LongId to java.lang.Long Below is the entity class: Station.java @Entity @Table(name = "STATION") public class Station extends GenericEntityModel<Long> { @Id @SequenceGenerator(name="STATION_SEQ_GEN", sequenceName="STATION_SEQ_GEN", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="STATION_SEQ_GEN") @Column