jpa-2.1

JPA 2.1/Hibernate 4.3 deprecation warning

喜你入骨 提交于 2019-11-28 03:36:14
问题 I'm using JPA 2.1 sample application with Hibernate 4.3.x implementation. <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="unit1"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <class>net.roseindia.model

Hibernate Envers fails with @Converter and AttributeConverter (JPA 2.1)

无人久伴 提交于 2019-11-27 18:28:01
问题 I am using Hibernate 4.3.4 with Envers, and MySql 5.6. Without a JPA 2.1 converter, the Party entity below fails at Configuration.buildSessionFactory() as it should, since Hibernate doesn't know what to do with the Name class: @Entity @Audited public class Party { protected Name name; ... } The exception is: org.hibernate.MappingException: Could not determine type for: ModuloADM.Party.Name, at table: Party, for columns: [org.hibernate.mapping.Column(name)] To fix this, I then add this

How to specify JPA 2.1 in persistence.xml?

家住魔仙堡 提交于 2019-11-27 10:25:25
问题 A quick search on the Net reveals three or four variants how folks have been specifying xmlns and xsi:schemaLocation in persistence.xml . What would be the 'correct' manner to specify JPA version 2.1? I'm using <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> 回答1: According to the official

JPA Query selecting only specific columns without using Criteria Query?

北城以北 提交于 2019-11-26 17:29:47
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! Yes, like in plain sql you could specify what kind of properties you want to select: SELECT i.firstProperty, i.secondProperty FROM ObjectName i WHERE i.id=10

JPA support for Java 8 new date and time API

a 夏天 提交于 2019-11-26 13:00:47
I'm using Java 8 for my new project. I'm trying to use new date and time api in java 8 however I don't know if JPA 2.1 fully supports this new Date and Time API or not. Please share your experience/opinion in JPA`s supports for new date and time API in Java 8. Can I use new date and time api in Java 8 safely with JPA 2.1? UPDATE: I'm using Hibernate (4.3.5.Final) as JPA implementation. JPA 2.1 is a spec that came out before Java 1.8, so doesn't mandate any support for it. Obviously some implementations may support some Java 1.8 features. Some have problems with Java 1.8 bytecode (e.g

JPA support for Java 8 new date and time API

只谈情不闲聊 提交于 2019-11-26 02:54:48
问题 I\'m using Java 8 for my new project. I\'m trying to use new date and time api in java 8 however I don\'t know if JPA 2.1 fully supports this new Date and Time API or not. Please share your experience/opinion in JPA`s supports for new date and time API in Java 8. Can I use new date and time api in Java 8 safely with JPA 2.1? UPDATE: I\'m using Hibernate (4.3.5.Final) as JPA implementation. 回答1: JPA 2.1 is a spec that came out before Java 1.8, so doesn't mandate any support for it. Obviously