eclipselink

Insert row to table with the only identifier column with EclipseLink

删除回忆录丶 提交于 2019-12-23 02:56:17
问题 I have an entity: @Entity public class MyEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = Columns.ID) private Long id; // getter & setter } Then, I create an instance of the entity MyEntity my = new MyEntity(); and want to save it with DAO (using Spring Data for JPA) - dao.save(my); . I got the following exception: Caused by: Exception [EclipseLink-6023] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.QueryException

JPQL Not a Selected Expression error

六眼飞鱼酱① 提交于 2019-12-23 02:55:27
问题 I have the following JPQL in ProductList Entity class which executes as expected. select DISTINCT new foo.bar.ProductListDTO(p.prodId, " + CASE WHEN (p.prodId = 'ZCX') THEN CONCAT(p.prodDesc, ' - ', e.userId) ELSE p.prodDesc END) from ProductList p LEFT JOIN p.productCatalogueList c where c.userId='ZAM' ProductListDTO class public ProductListDTO(String prodId, String prodDesc, String userId) { this.prodId = prodId; this.prodName = prodDesc; this.userId = userId; } What I would like to achieve

jpa many-to-many with additional column

拜拜、爱过 提交于 2019-12-23 02:52:40
问题 I have a many-to-many relationship with an additional column between two entities. On the owner side entity I have set the cascade type to persist. @OneToMany(cascade=CascadeType.PERSIST, fetch = FetchType.LAZY, mappedBy = "definitionType") private List<DefinitionProperty> definitionProperties = new ArrayList<DefinitionProperty>(); Here is my new entity which represents table: @EmbeddedId protected DefinitionPropertyPK pk; @JoinColumn(name = "dtid", referencedColumnName = "id", insertable =

How to configure an eclipselink JTA sequence connection pool

[亡魂溺海] 提交于 2019-12-23 02:32:10
问题 I have been having concurrency problems with TABLE sequences on MySQL and found advise that the solution may be configuring a separate connection pool for sequence generation. In this stackoverflow question it points to the Eclipselink Documentation which has a section for an example that's empty. I can't seem to find any example of how this is configured. My persistence.xml at the moment is below. What should I change to ensure sequence generation is executed on a seperate transaction /

Problem removing entity with JPA

吃可爱长大的小学妹 提交于 2019-12-23 02:02:00
问题 UPDATE My friend did the same lines of code and his lines just worked. What could it be? I use NetBeans 7.0.1 and his is 6.9.1. My GlassFish is 3.1 and his is 3.0.1 END OF UPDATE @Inheritance(strategy= InheritanceType.JOINED) @Entity @Table(name = "vehicle") @DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.INTEGER) @NamedQueries({ @NamedQuery(name = "Vehicle.findAll", query = "SELECT v FROM Vehicle v")}) public class Vehicle implements Serializable { private static

Why doesn't JPA's FetchType.LAZY work?

爷,独闯天下 提交于 2019-12-23 01:52:07
问题 JPA provider eclipselink 2.3 AS glassfish 3.1.1 B12 Binary protocol for remote invocation Hessian Server side ejb+jpa Client side Plain Swing . JPA mappings @Entity @Table(name = "FATHER", catalog = "CAT", schema = "dbo") public class Father implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(generator = "FATHERUID", strategy = GenerationType.TABLE) @TableGenerator(name = "FATHERUID", table = "FAMILY_UID", catalog = "LSDB", schema = "dbo",

Why doesn't JPA's FetchType.LAZY work?

回眸只為那壹抹淺笑 提交于 2019-12-23 01:52:07
问题 JPA provider eclipselink 2.3 AS glassfish 3.1.1 B12 Binary protocol for remote invocation Hessian Server side ejb+jpa Client side Plain Swing . JPA mappings @Entity @Table(name = "FATHER", catalog = "CAT", schema = "dbo") public class Father implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(generator = "FATHERUID", strategy = GenerationType.TABLE) @TableGenerator(name = "FATHERUID", table = "FAMILY_UID", catalog = "LSDB", schema = "dbo",

How can I prevent Eclipselink from consuming all memory with the cache?

和自甴很熟 提交于 2019-12-22 18:33:49
问题 My application extracts large amounts of geometry data. I use Eclipselink 2.4.1 to persist that data in a MySQL database. The application works batch-style, i.e. I gather a set of data, then persist it, and continue with the next set, persist it and so on. Another application later reads that data and processes it, but this question is only about the first application that gathers the data. The data-gathering application runs for quite some time. I use a fixed set of EntityManagers which are

List wrappers in JAXB MOXy

安稳与你 提交于 2019-12-22 17:08:34
问题 I am declaring a List object property with: @XmlRootElement(namespace = "...") @XmlType public class Test { private List<String> myList; @XmlElementWrapper(name = "myListWrapper") @XmlElement(name = "myList") public List<String> getMyList() { return myList; } } When an instance of this class with an empty list myList is marshalled, MOXy is not generating an empty wrapper MyListWrapper . However, JAXB RI would do it. The generated XML looks like this when using the RI: <ns2:test xmlns:ns2="...

Constructor queries on a non-persistent entity unexpectedly fail to supply a Boolean parameter as a constructor argument

点点圈 提交于 2019-12-22 12:39:08
问题 There are two tables in MySQL database user_table feedback The relationship between them is intuitive - one to many from user_table to feedback . I need to fetch only a list of selected columns from these tables which are From feedback feedbackId (java.lang.Long) feedbackTitle (java.lang.String) feedbackDescription (String, decorated by @Lob ) feedbackDate (org.joda.time.DateTime) testimonial (java.lang.Boolean) From user_table userId (java.lang.Long) firstName (java.lang.String) These many