I want to do something like this:
@Entity public class Bar {
@Id @GeneratedValue long id;
List<String> Foos
}
and have the Foos persist in a table like this:
foo_bars (
bar_id int,
foo varchar(64)
);
UPDATE:
I know how to map other entities, but it's overkill in many cases. It looks like what I'm s...
Hello
I'm new here and need some help :)
It's been several days that i got deadlock issues on a Java application with Glassfish - EJB3 with Mysql InnoDB
Config:
Mysql InnoDB: Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2
Application server: Glassfish v2.1
Persistance with EJB3 - JPA - Hibernate
To make i...
Is it possible in plain JPA or JPA+Hibernate extensions to use a foreign key that is also part of the composite primary key?
@TableGenerator(name = "trial", table = "third",
pkColumnName = "a" , valueColumnName = "b", pkColumnValue = "first")
@Entity
public class First{
@Id
@GeneratedValue(strategy = GenerationType.T...
Hi there,
I am basically a newbie whose starting work on a new webapp. The webapp is mostly your basic CRUD operations. For this, I have decided to use JPA with Hibernate as the Persistence provider and will be developing on Apache Derby for development and testing purposes. I am using GlassFish v2 as the App Server to deploy my EJB3 be...
I have a simple Class Hierarchy that I am trying to get to work with Hibernate/JPA.
Basically what I want is for the MovementData to be in its own Table with a FK to the integer id of the Main Vehicle Table in the Database.
Am I doing something wrong? How else can I accomplish something similar?
I am pretty sure I am following the JPA...
Hi all,
I have a situation where I am working with EJB3 and a legacy database. I have a situation where there is a many-to-many relationship between two tables A and B, defined through a third (link) table L.
The complication is that the link table has other fields in it other than the PK's of tables A and B. The columns are standard t...
I am using JPA with Hibernate underneath, and I am having trouble getting merge to work,
but before I describe the problems I am encountering with JPA, let me lay out what I am trying to accomplish, just in case my problems stems from my approach.
I have data from on system that I need to place into another system. To do this I am read...
Hi, all. I'm facing what I think is a simple problem with Hibernate, but can't get over it (Hibernate forums being unreachable certainly doesn't help).
I have a simple class I'd like to persist, but keep getting:
SEVERE: Field 'id' doesn't have a default value
Exception in thread "main" org.hibernate.exception.GenericJDBCException: cou...
Not sure if 'scope' is the correct term here.
I am using Spring for JPA transaction management (with a Hibernate underneath). My method to preform database transaction is private, but since you can only set @Transactional on a class or on a public method
Since this mechanism is based on proxies, only 'external' method calls coming i...
I have 2 EJB 3 Entity Beans:
@Entity
public class Organisation
{
@Id
@Column(length = 64)
private String guid;
private String name;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JoinColumn(name = "home_unit_fk", nullable = true)
private Unit homeUnit;
}
@Entity
public class Unit
{
@Id
@Column(len...
I'm trying to write a simple web app with Spring 2.5 (core + MVC) and JPA (using Hibernate for the persistence mechanism). Every time I deploy, I'm getting a "Class not found exception" that points to ClassVisitor.
This is a known version problem with the asm library. In a stand-alone app, I can make sure that the proper asm version i...
I have a list of objects and each and every object in the list have a position which may not change unless explicitly changed, in other words, the objects are in a queue. What collection should I use in my entity class to store these objects and how should that collection be annotated?
I currently have this
@Entity
class Foo {
...
...
In my SQL Server 2000 database, I have a timestamp (in function not in data type) column of type datetime named lastTouched set to (getdate()) as its default value/binding.
I am using the Netbeans 6.5 generated JPA entity classes, and have this in my code
@Basic(optional = false)
@Column(name = "LastTouched")
@Temporal(TemporalType.TIM...
I'm using Spring with Hibernate as a JPA provider and are trying to get a @OneToMany (a contact having many phonenumbers) to save the foreign key in the phone numbers table. From my form i get a Contact object that have a list of Phone(numbers) in it. The Contact get persisted properly (Hibernate fetches an PK from the specified sequence...
I'm looking for an easy way to extend existing JPA mapping. The idea is as follows:
I have an EAR project with EJB3+JPA module which has ClassA annotated and mapped to table class_a. But I want some other module (another EJB module) to have ClassB which adds more properties to ClassA (extend?).
One way that I though about, is just to a...
I want to save history of changes, so in @PostUpdate i want to create new instance of another entity and save it, how do i pass EntityManager to that method?
...
I am trying to make my java application more standards compliant and one of the biggest issues i am facing is transitioning our ORM framework from Castor JDO to a JPA implementation (thinking either Hibernate or DataNucleus). We have our own persistent data abstraction layer so the basic refactoring can easily be done by adding a JPA imp...
What I found so far are some online resources like this:
http://www.torsten-horn.de/techdocs/java-hibernate.htm (GER)
https://www.hibernate.org/5.html (Hibernate Docs)
http://docs.jboss.org/hibernate/stable/core/reference/en/html/tutorial.html
http://www.manning.com/bauer2/chapter2.pdf (Sample chapter of Java Persistence with Hiberna...
I have two entity classes annotated in the following way
@Entity
class A {
@ManyToMany(mappedBy="A", cascade=CascadeType.ALL)
private List<B> b;
..
}
@Entity
class B {
@ManyToMany(cascade=CascadeType.ALL)
private List<A> a;
..
}
If I store an instance of the class 'B', the relations are stored in the database and the g...
I'm trying to use automatic dependency injection via Spring's @Configurable annotation w/ @Resource on the fields needing injection. This involved some setup, like passing spring-agent.jar to my JVM. For the full details see here.
It works... mostly. When my Tomcat is booting up, I see the AspectJ init messages, my User objects automati...