In my specific case, I am making use of a discriminator column strategy. This means that my JPA implementation (Hibernate) creates a users table with a special DTYPE column. This column contains the class name of the entity. For example, my users table can have subclasses of TrialUser and PayingUser. These class names would be in the DTY...
How can I configure Jetty to use Java Persistence API? I would prefer to use toplink-essentials.
...
I am facing an issue when am getting the EntityManagerFactory from JPA from the following code in weblogic StartUp Class
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("testEJBPU");
logger.info("Created EntityManagerFactory");
Context ctx = new InitialContext();
ctx.rebind("testEJBPU", emf...
I'm trying to run hibernate tools in an ant build to generate ddl from my JPA annotations. Ant dies on the taskdef tag. I've tried with ant 1.7, 1.6.5, and 1.6 to no avail. I've tried both in eclipse and outside. I've tried including all the hbn jars in the hibernate-tools path and not. Note that I based my build file on this post:
...
I have the REGION table:
REG {
id number,
dateCreation Date
}
I have a LOCALE table:
LOCALE {
locale String
}
I have a REGION_DESCRIPTION table:
REGION_DESCRIPTION {
locale String,
regId number,
description
}
REGION_DESCRIPTION has a composite key: locale is a foreign key pointing to the LOCALE ...
Is it possible to use a map with a non-entity class in JPA? If yes, how should it be annotated correctly?
@Entity
class A {
@HowShouldIAnnotateThis?
private Map<B, Integer> myMap = new HashMap<B, Integer>();
}
@Entity
class B {
...
}
...
How should I use EclipseLink's @BasicMap annotation for a map whose key value is an entity and the value is an Integer?
@Entity
class A {
// This doesn't work, as the key is an entity
@BasicMap
private Map<B, Integer> myMap = new HashMap<B, Integer>();
}
@Entity
class B {
...
}
...
Let's say i have two tables in db: Car and Part. Car owns arbitrialy number of parts.
Because i use EJB 3.0 i have entity beans for Car and Part and Car entity bean contains list of Part objects.
I want to save new Part to db and right after that fetch from db all Cars. I exepect Part i've just added to be amongst parts associated with...
Im getting a weird error when running my spring2.5.6,jpa(hibernate3.4) webapp in weblogic 10.3
[ERROR] Javassist Enhancement failed: com.xxx.domain.model.Scheme
java.lang.NoSuchMethodError: pcGetManagedFieldCount
at com.xxx.domain.model.Fund.<clinit>(Fund.java)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
...
I have the following java class:
package domain;
//imports
@Entity
public class User {
@Id @GeneratedValue
private long id;
private String name;
private String password;
private String mail;
//Getters, Setters and Constructors
}
When I change the file extension to .groovy, the application stops working. In ...
Hi am i'm trying the new Java support for google app engine, and i am trying to make a persistency layer for all my objects. I am trying to model a friend connection but am running into problems. I use JPA to persist the objects and define my persistency objects with JPA annotations.
My idea was to do the following:
User Object:
@E...
liquibase is a perfect alternative to hibernate's hbm2ddl_auto property if you are using xml-mapping. But Im using JPA annotation (hibernate annotations). Is it possible to use liquibase then?
...
I'm playing around with some JPA stuff, changing the mappings to see how they're supposed to be etc. It's basic experimentation. However I can't find a tool that will simply read my entities and then generate the table schema for me. I tried to find something like this in JBoss tools but nada. Eclipse integration will be a huge plus but ...
I'm doing bulk inserts with JPA using Hibernate as my provider. The DB is Oracle. It created a sequence generator, and each time it does an insert it queries the sequence generator for nextval. If I'm doing 1K inserts, it will hit the sequence generator 1K times. Any way to speed this up, if I want to stick with JPA?
...
I want to get my feet wet with Spring/Hibernate. But I think I move along faster and am more motivated if I am working with code rather than just reading a book chapter by chapter.
Does anyone have any good ideas for a home project to work on to learn these technologies? Any exercises that you might have worked on and thought useful?
O...
EntityManager doesn't seem to care in which order to persist entities but I need that.
Any ideas?
...
I have a one-to-one relationship but hibernatetool complains when generating the schema. Here's an example that shows the problem:
@Entity
public class Person {
@Id
public int id;
@OneToOne
public OtherInfo otherInfo;
rest of attributes ...
}
Person has a one-to-one relationship with OtherInfo:
@Entity
public cl...
@TableGenerator(name = "trial", table = "third",
pkColumnName = "a" , valueColumnName = "b", pkColumnValue = "first")
@Entity
public class First{
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "trial")
protected int a;
@OneToMany(mappedBy ="first", cascade = CascadeType.PERSIST)
@JoinColu...
I deal with legacy data base such that some tables joined on primary keys
the following is a simple example:
@TableGenerator(name = "trial", table = "third",
pkColumnName = "a" , valueColumnName = "b", pkColumnValue = "first")
@Entity
public class First{
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator...