Hi!
How can I configure a schedule intervals
(@Schedule(persistent=true, minute="", second="/5", hour="*") )
outside from application:
How can I configure it in ejb-jar.xml?
Can I configure it outside from application (kind of properties file)?
Thanks!
...
Hi,
I have a DAO where I need to catch an unique constraint exception. To do this, the only working solution is to flush my EntityManager after the persist. Only then I come into a catch block where I have to filter out the exception. And, my DAO method needs to be wrapped in a transaction (REQUIRES_NEW) otherwise I have the RollBackExc...
I am facing issues while retrieving data for entities having bi-directional many-to-many relationship. If I use List for storing entities, I get unable to fetch multiple bags simultaneously error. If i change my code to use Set, I get stackoverflow error.
Details :
Spring 3.0.3
Hibernate-core : 3.5.1-Final
Hibernate-annotations : 3.5....
The following query is only matching the first value found in the select subquery, even though there are match for all values SELECT p FROM Profile p WHERE p.id IN (SELECT u.group FROM User u WHERE u.id = ?1)
The subquery returns a comma separated list like: 1,2,3. The query should return matches for all three subquery select results. A...
Hello there,
I was learning some JPA to teach to some java friends and I was wondering, how do you handle updates that comes after the creation of the db in JPA? Let's say I have a production environment where there's data that I cannot lose.
Some changes comes in and how do I apply that on my production environment? It there a way th...
I would like to use Criteria API in my new project and from what I understood, I also need to do annotation processing. Since there Java 5 on the server, how is this possible using Java 5 and Maven?
...
I've been trying to find a JPA Criteria API tutorial but haven't been much successful. Do you know about any for beginners? I'd like to start using it in an Java5/Maven app to build complex search queries.
...
In my Wicket+JPA/Hibernate+Spring project, much of the functionality is based around the Inbox page where, using many filtering options (not all of them have to be used), users can restrict the set of objects they want to work with. I was wondering what the best strategy to implement this filtering is? In the old version of this applicat...
I am trying to implement the following convenience method:
/**
* Counts the number of results of a search.
* @param criteria The criteria for the query.
* @return The number of results of the query.
*/
public <T> int findCountByCriteria(CriteriaQuery<?> criteria);
In Hibernate, this is done by
criteria.setProjection(Projections....
When I execute:
public void beginTransaction() {
em.getTransaction().begin();
}
following an active transaction started in the same way, I get the following exception:
Exception Description: Transaction is currently active
java.lang.IllegalStateException:
Exception Description: Transaction is currently active
at ...
I am trying to do a simple persistence with jpa 2.0 and derby but I keep getting a NullPointerException.
Exception and entity class - http://pastebin.com/QqXhRdcN
The code where I am trying to persist
EntityManager em = emf.createEntityManager();
Course c = new Course("cse", 214, "fall", 2010);
em.getTransaction().begin();
...
Hello,
The following code throws an exception when invoking "em.refresh(p)":
1: EntityManager em = emf.createEntityManager();
2: em.getTransaction().begin();
3:
4: Product p = new Product("J&D", 35.0,"Whisky");
5: em.persist(p);
6:
7: em.refresh(p);
8: em.getTransaction().commit();
9: em.close();
When debugging the code, we see that ...
Using the EclipseLink JPA2 implementation (not sure if it's the same with the Hibernate implementation)
I have a simple structure where an Organization entity has contracts. Here's the sql I exported from postgres to create the Organization
CREATE TABLE organization (
key bigint NOT NULL,
version integer
);
If I specify the...
In an app based on JPA2/Hibernate/Oracle+Spring+Wicket, I use the following model:
public class Item {
private String name;
private Set<Application> apps;
private ...
}
public class Application {
private String applicant;
private Item item;
private Status status;
private ...
}
The mapping between Item and Application is that e...
Hi,
I'm currently trying to implement a ManyToMany Relationship with Data in the JoinTable.
I'm following this approach with the Eclipselink JPA Framework.
But I'm getting the following exception:
org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:210)
... 23 more
...
I'm trying to use Criteria API in my new project:
public List<Employee> findEmps(String name) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Employee> c = cb.createQuery(Employee.class);
Root<Employee> emp = c.from(Employee.class);
c.select(emp);
c.distinct(emp);
List<Predicate> criteria = new Arra...
I have a rather big model Applicant:
public class Applicant{
private Long id
private String name;
...
...
}
To populate a selection list, I need a list of (id, name) tuples and I use this search query:
public List getNames() {
Query query = em.createQuery("select a.id, a.name from Applicant a");
return query.getResultL...
Hi,
I have a problem when removing elements from a list mapped as described above. Here is the mapping:
@Entity
@Table( name = "foo")
class Foo {
private List bars;
@OneToMany
@OrderColumn( name = "order_index" )
@JoinTable( name = "foo_bar_map", joinColumns = @JoinColumn( name = "foo_id" ), inverseJoinColumns = @Jo...
I have an @Stateless EJB method in which I
delete some entries from a database
using JPA remove()'s
throw an Exception that is annotated as @ApplicationException(rollback=true)
I have no other transaction-specific annotations for the method (I set @TransactionAttribute(TransactionAttributeType.REQUIRED) but that should be the defau...
I have an one-to-one, bidirectional entity relationship with shared keys. When I attempt to save the owner of the association I get a "null id generated" exception against the owned side of the relationship. I am utilizing hibernate-entitymanager and using spring for transaction management.
Owning Entity
@Entity
@Table(name = "lead")
p...