jpa-2.0

Datanucleus JPA 2 Level 2 cache in Google AppEngine

时光怂恿深爱的人放手 提交于 2019-12-01 09:44:22
What am I missing in the following configuration that my Datanucleus JPA 2 Level 2 cache is not using Google App Engine Memcache service? I am using the GAE 1.7.2 SDK. In the persistence.xml: <persistence-unit name="transactions-optional"> <provider>org.datanucleus.api.jpa.PersistenceProviderImpl</provider> <properties> <property name="datanucleus.NontransactionalRead" value="true"/> <property name="datanucleus.NontransactionalWrite" value="true"/> <property name="datanucleus.ConnectionURL" value="appengine"/> <property name="datanucleus.appengine.datastoreReadConsistency" value="EVENTUAL" />

How can I generate DDL from existing entities with annotations using a maven plugin?

老子叫甜甜 提交于 2019-12-01 09:34:33
问题 I have maven project and I want to generate DDL from existing entities. How can I do that? Is there any maven plugin that I can generate the DDL? I am using JPA.(open jpa) 回答1: openjpa-maven-plugin plugin provides a goal sql . Using this goal, it is possible to create the DDL from existing entities. <pluginManagement> <plugin> <groupId>org.apache.openjpa</groupId> <artifactId>openjpa-maven-plugin</artifactId> <version>2.2.0</version> <configuration> <includes>**/entity/ *.class</includes>

jpa case-insensitive in-clause for a list of string values

僤鯓⒐⒋嵵緔 提交于 2019-12-01 08:46:29
问题 I want to know if JPQL is capable of doing a case-insensitive search on a collection of string. Scenario: Table1: Column1 (int) | Column2(string) 1 ABC 2 XYZ I am looking for a JPQL query which does something like this from Table1 a where upper(a.column2) in upper(:listOfCol2Values) Can I achieve this without having to change the case at the application code where i set the collection. Cheers. 回答1: No you cannot. Reason is that UPPER and LOWER operate to the strings, so they do not take

JPA: MySQL says table don't exist, but it exist actually

六眼飞鱼酱① 提交于 2019-12-01 08:34:57
I have the follow script to create the table autolife.log: CREATE TABLE `log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idpoint` int(11) NOT NULL, `value` varchar(10) NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `fk_point_id` (`idpoint`), CONSTRAINT `fk_point_id` FOREIGN KEY (`idpoint`) REFERENCES `point` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=155562 DEFAULT CHARSET=latin2$$ So I use the JPA Tools to create Entity from Tables in Eclipse Indigo: @Entity public class Log implements

JPA 2.0: TYPE expression exception

﹥>﹥吖頭↗ 提交于 2019-12-01 08:21:06
问题 I have a inheritance structure with to classes, let's say Parent (as the root class) and Child as the subclass. So with JPA 2.0 no I can select only the Parent class by using SELECT p FROM Parent p WHERE TYPE(p) = Parent This only should return entries of Parent and not also the entries of child. But with my EclipseLink 2.1.1 and MySql on Glassfish v3, I always get the following error: "Invalid Type Expression on [my.domain.Parent]. The class does not have a descriptor, or a descriptor that

How do I write a JPA criteria query that matches a collection exactly?

陌路散爱 提交于 2019-12-01 08:12:12
I’m using JPA 2.0 with Hibernate 4.1.0.Final. I have a couple of classes, Groups and GroupMembers. Each GroupMember is tied to a user object @Entity @Table(name = "group") public class Group { @Id @NotNull @GeneratedValue(generator = "uuid-strategy") @Column(name = "ID") private String id; … @OneToMany(mappedBy = "group") private Set<GroupMember> members; @Entity @Table(name = "sb_msg_group_member") public class GroupMember { … @ManyToOne @JoinColumn(name = "USER_ID", nullable = false, updatable = true) private User user; Is it possible to write a JPA criteria query that given a java.util.Set

Is the element of “initialValue” of @TableGenerator not supported in Hibernate JPA?

て烟熏妆下的殇ゞ 提交于 2019-12-01 07:55:37
问题 @TableGenerator(name="Emp_Gen",table="ID_GEN", pkColumnName = "GEN_NAME",pkColumnValue = "Employee_GEN",valueColumnName = "GEN_VAL",initialValue = 1000,allocationSize = 100) Every is ok,but initialValue is not effective. Below is the table named "employee"(Note:MySql,Hibernate-JPA is used) I think the first row 'id' is 1000,not 1,right?But if it's 1,the second should be 101.... Who can help me a stupid man? 回答1: What it comes to the first value being 1 instead of 1001 that is Hibernate bug

JPA: MySQL says table don't exist, but it exist actually

佐手、 提交于 2019-12-01 06:24:40
问题 I have the follow script to create the table autolife.log: CREATE TABLE `log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idpoint` int(11) NOT NULL, `value` varchar(10) NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `fk_point_id` (`idpoint`), CONSTRAINT `fk_point_id` FOREIGN KEY (`idpoint`) REFERENCES `point` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=155562 DEFAULT CHARSET=latin2$$ So I use

JPA: How to perform a LIKE with a NUMBER column in a static JPA MetaModel?

依然范特西╮ 提交于 2019-12-01 06:08:20
问题 I do have a static metamodel with a NUMBER (actually, BigDecimal, don't ask why) column. Now I would like to do a LIKE query against that number column: CriteriaBuilder cb; cb.like(entity.get(Entity_.numbercol), "123%"); where entity.get(Entity_.numbercol) returns a Path<BigDecimal> . Naturally, I get a compile error: ...like(Expression<String>, ...) ... not applicable for the arguments (Path<BigDecimal>, ...) Casting the column with .as(String.class) fails due to some Bug in JPA, but I don't

Configuring persistence and orm with JPA 2

十年热恋 提交于 2019-12-01 06:04:59
I'm having some trouble using Persistence on my jBPM project. My configuration is jBPM 5.4 + Hibernate + JPA 2, and I'm currently setting up the process flow to connect to a DB with persistence, through persistence.xml. I'm just trying to connect the default data source (in the H2 server) with my custom persistence.xml, but I keep getting the same error over and over again: Unknown entity: org.jbpm.persistence.processinstance.ProcessInstanceInfo I've manually added to my src/META-INF folder the JBPMorm-JPA2.xml the following content, but the error still persists. Can anyone help me? JBPMorm