I'm aware that JSR-000220 Enterprise JavaBeans 3.0 Final Release (persistence) spec states:
"In general, portable applications should not invoke EntityManager or Query operations,
access other entity instances, or modify relationships in a lifecycle callback method."
This appears extremely restrictive. We have a situation in which we w...
I'm trying to use the JPA EntityManager find() method. My primary key is a string which corresponds to a user's name.
I am using JPA / Hibernate / MYSQL.
My problem is a search for user 'David' matches user 'david' due, I assume, to the case insensitive string matching in the underlying MYSQL. This causes me a whole heap of problems!...
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...
I'm having some fun writing a strategy/fantasy game with Seam.
Unlike a typical Seam application there is a lot of asynchronous activity; scheduled methods update player data, both offline and online, and using Icefaces' Ajax push the players views are updated with relevant information, like available gold, stone, chat messages etc.
My...
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...
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 have the following many-to-many mapping:
public class Student implements
{
@Id
@GeneratedValue
private Integer xID;
@ManyToMany
@JoinTable(name = "x_y",
joinColumns = { @JoinColumn(name = "xID")},
inverseJoinColumns={@JoinColumn(name="yID")})
private Set<Cat> cats;
}
public class Cat implements
{
@Id
...
Hi. I have a button in a .xhtml file which calls a javascript function which calls a java function remotely (in jboss seam environment). That java function has an entityManager.persist(object). Do you know why this line of code doesn't commit to the DB?
It says something that a transaction hasn't started. I supose in a remote context i d...
In the following code I am trouble with my injected EnitityManager, which always shows up as null;
public class GenericController extends AbstractController {
@PersistenceContext(unitName = "GenericPU")
private EntityManager em;
protected ModelAndView handleRequestInternal(
HttpServletRequest request,
...
Hey fellows,
Because calling a flush() to get every entities persist from memory to database. So if I use call too much unnecessary flush(), it could take much time therefore not a good choice for the performance. Here is a scenario that I don't know when to call a flush()?
//Order and Item have Bidirectional Relationships
Order ord = ...
EntityManager.merge() can insert new objects and update existing ones.
Why would one want to use persist() (which can only create new objects)?
...
I've set up a JSF application on JBoss 5.0.1GA to present a list of Users in a table and allow deleting of individual users via a button next to each user.
When deleteUser is called, the call is passed to a UserDAOBean which gets an EntityManager injected from JBoss.
I'm using the code
public void delete(E entity)
{
em.remove(em.merg...
The headline says it all: I've got a simple WebService
@WebService(serviceName="G08WService", portName="G08WPort", endpointInterface = "at.fhj.itm.g08.wservice.IUserWebService")
public class WService implements IUserWebService
{
@PersistenceContext(unitName="g08b2")
EntityManager em;
@Resource
UserTransaction utx;
...
A long question, please bear with me.
We are using Spring+JPA for a web application. My team is debating over injecting EntityManagerFactory in the GenericDAO(a DAO based on Generics something on the lines provided by APPFUSE, we do not use JpaDaosupport for some reason) over injecting an EntityManager. We are using "application managed...
Sorry for the noob question, but I'm having problems with JPA+Hibernate so I thought that something is not clear in my mind.
I have some entities, say A, B, C, D and I have coded AMethods, BMethods, CMethods, DMethods. Each of the *Methods classes contain EntityManager initialization via EntityManagerFactory and some methods that basica...
I have an entity class and an entity DAO class.
Should it be the responsibility of the DAO class to create instances of the entity class, or should there be an entity creator/manager class that uses the DAO class only to get the data from the database to create the entity class.
Thanks,
Chris
...
Can somebody tell me the intrinsic reasons why in the JPA 1.0 EntityManager when retrieving an Object via find, you have to deal with null if not found, but when using the Query interface via createQuery getResultList throws a NoResultException when not found.
Maybe i am missing something but I feel its very inconsistent for a Language,...
I reverse engineered some db tables, and a facade interface and implementing class were made.
I need to do a refresh() on an entity, but the EntityManager is private from the reverse engineering, and I do not want to edit a reverse engineerined class.
How do I go about getting the EntityManger so I may call refresh()?
...
I have a managed bean / service running inside of JBOSS. I then have a quartz job that will occasionally wake up and call a method of the managed bean. This method is sometimes long and drawn out, and since I don't want the quartz job to time out, I have implemented a thread within the managed bean to perform the processing. When the ...