I read in several places that JPA2 will support a detach method call on Entity Manager. I am running with Hibernate 3.5.1-FINAL and Spring 3.0.2-RELEASE as Maven dependencies -- snagged from the JBoss repository.
Isn't this enough?
Perhaps the problem is with my javax.persistence.EntityManager interface definition. Do I need to updat...
What I am trying to do is inject through XML almost the same way that is done through A @PersistenceContext annotation. I am in need of this because of the fact I have different entity managers I need to inject into the same DAO. The databases mirror one another and I would rather have 1 base class and for instances of that base class ...
Java EJB's EntityManager does not update data from a Consumer.
A Consumer logs into a shop, buys some stuff and wants to look at his shopping-history. Everything is displayed but his last purchase. If he logs out and in, it shows.
I have used JPA to persist buys/purchases (that are mapped to the Consumer)to DB. It seems like purchases...
Can I create an EntityManager from EntityManagerFactory outside a bean. If so, how would I do it?
...
I have a JPA/Spring application that uses Hibernate as the JPA provider. In one portion of the code, I have to manually create a DAO in my application with the new operator rather than use Spring DI. When I do this, the @PersistenceContext annotation is not processed by Spring.
In my code where I create the DAO I have an EntityManager...
I would like to set the testConnectionOnCheckin property for c3p0.
However I am having trouble doing so because the c3p0 datasource is created on my behalf within a hibernate entity-manager bean.
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitM...
I am am tryign to access two dbs via one slsb, specifically one method within an slsb. However this is not possible ? Other than altering the stored procs is there anything else I could do ?
@PersistenceContext(unitName = "DB1")
private EntityManager oneEntityManager;
@PersistenceContext(unitName = "DB2")
private EntityManager twoEnt...
I am using Java SE and learning about the use of a persistence API (toplink-essentials) to manage entities in a Derby DB. Note: this is (distance learning) university work, but it is not 'homework' this issue crops up in the course materials.
I have two threads operating on the same set of entities. My problem is that every way I have t...
I'm trying to write a JUnit test for a Spring Roo project. If my test requires use of the entity classes, I get the following Exception:
java.lang.IllegalStateException: Entity manager has not been injected
(is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)
The Spring Aspects JAR looks to be configured correctly....
There are 19 methods in our DAO layer, each is some variation of this:
public TicketProp saveTicketProp(TicketProp prop) {
EntityManager em = this.emf.createEntityManager();
try {
em.getTransaction().begin();
prop = (TicketProp) em.merge(prop);
em.getTransaction().commit();
return prop;
} fina...
I am building a project with Stripes, Spring, JPA & Hibernate amd have an object with a many to one child collection. I have set the loading as Lazy
eg.
@OneToMany(cascade = CascadeType.MERGE, mappedBy = "paperOffering", fetch = FetchType.LAZY)
private List<PaperOfferingAssessment> paperOfferingAssessments;
Now I am getting the Lazy...
I am using Glassfish v3 server.
Usually the DB connection with EJB3 + JPA (Eclipselink) is done through injection, with @PersistenceUnit or @Persistencecontext.
However, there are 3 layers in my App :
Core (contains business logic, entities, exception handling etc)
an EJB on top of it, calling the right core objects and methods to do...
Hi,
I have a background service that runs every 10 min.
This service queries the DB for jobs to execute a will load a class with a different business logic according to the job (using Class.forName()). They implement the same Interface, of course.
I declared those classes to be SEAM components but when I try to use the entityManager ...
I'm getting an NPE for my EntityManager and can't figure out why - can anyone spot my mistake?
UserManagerImpl.java
@Stateless
public class UserManagerImpl implements UserManager {
@PersistenceContext(unitName = "persistenceUnit")
EntityManager em;
public List<User> findUsers() {
return (List<User>) em.createQuery("from User").g...
I don't know if this is a problem that is specific to Google App Engine for Java, but if the value set as the keywords parameter is a null String, then nothing is returned from the query, even if a minPrice is set.
How do I change this query to make it return records that meet the minPrice condition even if the keywords value is null? ...
We are migrating a JDBC based application to JPA and EJB3. Our old application used the Connect#setClientInfo API to record the current user name as part of the client info:
http://download.oracle.com/javase/6/docs/api/java/sql/Connection.html#setClientInfo%28java.lang.String,%20java.lang.String%29
We need to do something similar in th...
Hi,
I'm creating an EJB3 module which tries to respect a specific facade/implementation design pattern. My facade should be totally EJB free.
I have 2 classes in this module: an entity bean and a session bean, which is the manager of this entity. The manager contains an EntityManager attribute.
I also have a factory which instantiates...
String myQuery1 = "insert into mytable(mycol) values(myval) \ngo";
String myQuery2 = "insert into mytable(mycol) values(myval2) \ngo";
String myQuery = myQuery1 + myQuery2;
Query query = myEntityManager.createNativeQuery(myQuery);
List<?> insertResultList = queryInsertDefaults.getResultList();
using the eclpise debugger I can see th...
I've encountered a problem I don't really understand - unless a method working with the DAO is annotated as @Transactional, the underlying database doesn't get updated. My app runs on JPA/Hibernate, Spring and Wicket. Why is that?
DAO:
@Repository(value = "userDao")
public class UserDaoJpa implements UserDao {
@PersistenceContext
...
I am getting following exception while i try to execute simple jpa code.
What may be the casue?
5453 DevPQRWDPBSSPersist WARN [P=351601:O=0:CT] openjpa.Enhance - This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "[class com.XYZ.PQ...