jpa-2.1

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

@ConstructorResult mapping in JPA 2.1 does not work properly with Hibernate 4.3.5.Final

廉价感情. 提交于 2019-12-22 09:28:14
问题 I try to map a native query to a non-Entity class. I have the following Entity: @Entity @Table(name = "Groups") @SqlResultSetMapping(name = "groupList", classes = { @ConstructorResult(targetClass = GroupListEntry.class, columns = { @ColumnResult(name = "id", type = Long.class), @ColumnResult(name = "name", type = String.class), @ColumnResult(name = "typeId", type = Long.class), @ColumnResult(name = "lastUpdateDate", type = Date.class) }) }) public class GroupEntity implements Serializable { .

How to use JPA 2.1 property javax.persistence.schema-generation.database.action?

时光怂恿深爱的人放手 提交于 2019-12-21 04:40:28
问题 Allowed values for javax.persistence.schema-generation.database.action are none (that doesn't serve anything...) create (which only works the first time the application is started because all further starts fail due to most databases (e.g. derby 11.x) fail if a schema that already exist is created drop-and-create (which wouldn't ever persist any data which raises the question why it's part of a persistence standard specification - assuming debugging purpose) drop (symetrically fails create

How to use Constructor Mapping with Spring JPA Repositories

旧街凉风 提交于 2019-12-19 19:53:59
问题 I have a Spring repository as follows: import org.springframework.data.repository.Repository; import org.springframework.stereotype.Component; import com.test.domain.My; @Component public interface MyRepository extends Repository<My, String> { My findOne(String code); My findByName(String name); } The entity class is: import javax.persistence.ColumnResult; import javax.persistence.ConstructorResult; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence

Schema generation with EclipseLink and Hibernate (JPA2.1) - @ForeignKey ignored

一个人想着一个人 提交于 2019-12-19 03:49:54
问题 I am testing JPA2.1 and the new "schema generation" feature. For that, I tested two implementations under the HyperSQL database : EclipseLink 2.5.2-M1 which is the reference implementation. Hibernate 4.3 I don't have any preference for an implementation (not even for performance). I tested EclipseLink because it was the first JPA2.1 implementation available, but now, Hibernate 4.3 is here and JPA2.1 compliant. The only thing I want is to get something independent from the JPA provider -

org.hibernate.QueryException: illegal attempt to dereference collection

淺唱寂寞╮ 提交于 2019-12-18 10:37:54
问题 I am trying following hql query to execute SELECT count(*) FROM BillDetails as bd WHERE bd.billProductSet.product.id = 1002 AND bd.client.id = 1 But it is showing org.hibernate.QueryException: illegal attempt to dereference collection [billdetail0_.bill_no.billProductSet] with element property reference [product] [select count(*) from iland.hbm.BillDetails as bd where bd.billProductSet.product.id=1001 and bd.client.id=1] at org.hibernate.hql.ast.tree.DotNode$1

Generate DDL script at MAVEN build with Hibernate4 / JPA 2.1

女生的网名这么多〃 提交于 2019-12-18 01:18:29
问题 It seems like the hibernate3-maven-plugin used to generate DDL create/drop scripts is not compatible any more with Hibernate 4.3 and newer versions (using JPA 2.1 ). I use this plugin configuration : <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>3.0</version> <executions> <execution> <id>generate-sql-schema</id> <phase>process-sources</phase> <goals> <goal>hbm2ddl</goal> </goals> <configuration> <hibernatetool> <jpaconfiguration

JPA Query selecting only specific columns without using Criteria Query?

和自甴很熟 提交于 2019-12-17 03:35:14
问题 Is it possible to select, say, only properties A and B from an object using a JPA query without using criteria queries? To select all properties I'd just do something like: SELECT i FROM ObjectName i WHERE i.id = 10 But I have an object with many properties on a legacy system, and want to select just a few even though I'm aware selecting several properties is usually quick. Is this possible without using criteria queries? Thank you! 回答1: Yes, like in plain sql you could specify what kind of

@ConstructorResult with Enum in JPA 2.1

Deadly 提交于 2019-12-14 00:22:25
问题 I am not having any idea how to use Enum in @ColumnResult Type while using @ConstructorResult of @SqlResultSetMapping @SqlResultSetMapping(name="DetailAndResult", classes={ @ConstructorResult(targetClass=DetailAndResult.class, columns={ @ColumnResult(name="id", type= String.class), @ColumnResult(name="runId", type=Integer.class), @ColumnResult(name="subRunId", type=Integer.class), @ColumnResult(name="transactionId", type=Integer.class), @ColumnResult(name="referenceNumber", type=String.class)

org.hibernate.HibernateException [org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.]

拈花ヽ惹草 提交于 2019-12-13 08:25:54
问题 I know that may that question has been asked before, but the difference for my question is that I am using extended PersistenceUnit and also I am not the one who manages the transaction as the server is responsible for managing it. BTW I am using JPA(2.1) with hibernate(4.3.10) provider, PostgreSQL(9.5) DB and liberty server This is what I get in the browser And here are my entities in simple view @Entity public class GeoArea{ private Integer id;//Auto Generated private String name; private