I have an entity with Integer attributes that looks like this in proto code:
class MyEntity:
String name
@Choices({1, "BSD", 2, "Apache", 3, "GPL"}
Integer frequency
@ChoicesSegment({1000, 2000, 3000}, {"BSD", "Apache", "GPL"})
Integer type
String getFrequency()
return getChoice("frequency", frequen...
Has anyone done this or attempted to do this for a preexisting project?
It seems there are two options to go with here, either using the embedded EJB API basically the following class
javax.ejb.embeddable.EJBContainer
Which expects a configured glassfish v3 install to be available (application scoped resources will make this easier)...
Does anyone know if Hibernate 3.5 is supported under Seam 2.x (specifically 2.2.x)? I'm very interested in some of the JPA 2 features, particularly query building, but work within the Seam framework. Is this version of the library supported? Thanks in advance!
...
I'm using JPA 2.0/Hibernate validation to validate my models. I now have a situation where the combination of two fields has to be validated:
public class MyModel {
public Integer getValue1() {
//...
}
public String getValue2() {
//...
}
}
The model is invalid if both getValue1() and getValue2() are nul...
I have a JPA 2 Entity named Surgery. It has a member named transfusionUnits that is an Integer.
There are two entries in the database. Executing this JPQL statement:
Select s.transfusionUnits from Surgery s
produces the expected result:
2
3
The following statement produces the expected answer of 5:
Select sum(s.transfusionUnits...
Hi all
My choice is between
Tapestry 5
Vaadin
JSF2
--- start EDIT 2010-05-13 18:04 --
Spring MVC (don't know why I forgot to mention this)
--- stop EDIT 2010-05-13 18:04 --
I like Vaadin most, because it seems to come with all the look-and-feel features out-of-the-box, I wonder if anyone has experience with Vaadin and JPA2, pre...
Hi can anyone tell me if its possible to write a cross tab query in JPQL?
(I'm using eclipse link JPA2)
An example of a cross tab query in SQL can found here http://onlamp.com/pub/a/onlamp/2003/12/04/crosstabs.html
SELECT
dept,
COUNT(CASE WHEN gender = 'm' THEN id ELSE NULL END) AS m,
COUNT(CASE WHEN gender = 'f' THEN id ...
Hi all,
I am already using Hibernate Envers to audit entities that are updated by a user through the UI; however, I also have asynchronous jobs running in the background and would like to audit those as well using Envers. Now, for the UI, I track which HttpRequest made the change which gives me the date, user, session, etc. For the ba...
With Hibernate you can load your Entity classes as:
sessionFactory = new AnnotationConfiguration()
.addPackage("test.animals")
.addAnnotatedClass(Flight.class)
.addAnnotatedClass(Sky.class)
.addAnnotatedClass(Person.class)
.addAnnotatedCl...
Here the scenario: I have a unidirectional 1:N Relation from Person Entity to Address Entity. And a bidirectional 1:N Relation from User Entity to Vehicle Entity.
Here is the Address class:
@Entity
public class Address implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = Gene...
I have a simple @OneToMany between Person and Pet entities:
@OneToMany(mappedBy="owner", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
public Set<Pet> getPets() { return pets; }
I would like to load all Persons with associated Pets. So I came up with this (inside a test class):
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfig...
This seems like a pretty simple question, but I have not managed to find a definitive answer yet. I have a DAO class, which is naturally querying the database by using criteria queries. So I would like to know if it is safe to use the same CriteriaBuilder implementation for the creation of different queries or do I have to create new Cri...
I am rather new to JPA 2 and it's CriteriaBuilder / CriteriaQuery API:
http://java.sun.com/javaee/6/docs/api/javax/persistence/criteria/CriteriaQuery.html
http://java.sun.com/javaee/6/docs/tutorial/doc/gjivm.html
I would like to count the results of a CriteriaQuery without actually retrieving them. Is that possible, I did not find any...
Just a quick question:
There's the entity (for example User) who is connected with the ManyToMany relationship to the same entity (for example this relation describes "friendship" and it is symmetric).
What is the fastest way in terms of execution time to check if User A is a "friend" of user B? The "dumb" way would be to fetch whole L...
I have a class hierarchy of JPA entities that all inherit from a BaseEntity class:
@MappedSuperclass
@EntityListeners( { ValidatorListener.class })
public abstract class BaseEntity implements Serializable {
// other stuff
}
I want all entities that implement a given interface to be validated automatically on persist and/or update....
I'm trynig to use @OrderColumn annotation with Hibernate 3.5
@OneToMany(mappedBy = "parent",fetch=FetchType.EAGER, cascade=CascadeType.ALL)
@OrderColumn(name = "pos")
private List<Children> childrenCollection;
When retrieving data everyting works fine. But I can't make it to reorded elements in List and save new order to database.
...
Hi.
Is it possible (using Hibernate and JPA2 Criteria Builder [1]) to order by a method's result rather than an entity's member?
public class X {
protected X() {}
public String member;
public String getEvaluatedValue() { // order by
return "a status calculated with various members";
}
}
What I want to achive ...
I have a 100% JPA2 compliant application which needs to be portable to many application servers. Being JPA compliant (theoretically) means we can switch JPA providers via configuration (e.g. without changing source code) -- (right???).
When running within a servlet container (e.g. Tomcat, Jetty) the application is configured to run w...
I just upgraded to hibernate 3.5.1 and I get an error now saying:
java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval () Z.
This only happens with Tomcat not with Jetty.
I've checked and I don't have any conflict and this method definitely exists. I have hibernate-jpa-2.0-api-1.0.0.Final.jar on the class path, and...
I have the following entity class (ID inherited from PersistentObjectSupport class):
@Entity
public class AmbulanceDeactivation extends PersistentObjectSupport implements Serializable {
private static final long serialVersionUID = 1L;
@Temporal(TemporalType.DATE) @NotNull
private Date beginDate;
@Temporal(TemporalType....