Hibernate is an object-relational mapping (ORM) library for the Java language enabling developers to utilize POJO-style domain models in their applications in ways extending well beyond Object/Relational Mapping.
Hibernate is the umbrella for a collection of libraries, most notably Hibernate ORM which provides Object/Relational Mapping for java domain objects.
In addition to its own "native" API, Hibernate ORM is also an implementation of the Java Persistence API (jpa) specification.
I'm using Hibernate Validator and would like to resolve the category's name in an error message. Consider this simple scenario:
public class Category {
private String name;
}
public class Product {
@HazardousCategoryConstraint(message =…
I'm just starting with Grails, and here is the first issue.
I spent several hours to find out that domain object cannot be inserted in DB, until all its properties are populated.
class Item {
String title
String link
}
class ItemController {
…
I am using Hibernate as persistence provider and modelling my entities with JPA 2.
Now a question came up and i hope you can help me.
In my application you can open up a Game, create groups of players in it and walk around on the map (tiles (2d)).…
So with JPA/Hibernate you can certainly load an entity "proxy" without hitting the database using something like session.load() or entityManager.getReference().
However, it seems it's impossible to set a property on these "proxies" without Hibernate…
I want to implement something similar to triggers in hibernate.
What I need is when a column in a table attains a specific value, a row should be inserted in another table or some other table should be updated.
How do I implement this in hibernate…
I use Hibernate Envers:
@Entity
@Table(name = "user")
@Audited
class User()
{
private String id;
@Formula("(SELECT name FROM other c where c.id = id)")
private Integer name;
}
it…
Is it possible to obtain the Hibernate Session object from the EntityManager? I want to access some hibernate specific API...
I already tried something like:
org.hibernate.Session hSession =
( (EntityManagerImpl) em.getDelegate()…
I use Spring Data and decided that I want to create new custom data type that can be used in Hibernate entities. I checked the documentation and choose BasicType and implemented it according to this official user guide.
I wanted to be able to…
I used JPA CriteriaQuery to build my dynamic Query and pass in a Spring Data Pageable object:
sort=name,desc
At the backend I have a method in my Repository to support dynamic query:
public Page findByCriteria(String username, Pageable page)…
I would like to update my Maven pom.xml with the latest hibernate, hibernate-annotations, and ehcache dependencies.
I read the hibernate download page and the ehcache donwload page. All my tries at interpreting it seem to fail. Can someone write out…
I have a question about Postgres and GenerationType.Identity vs Sequence
In this example...
@Id
@SequenceGenerator(name="mytable_id_seq",
sequenceName="mytable_id_seq",
allocationSize=1)
@GeneratedValue(strategy…
Suppose I have a Post entity and a Comment entity and a one to many relationship:
@Entity class Post {
...
@OneToMany
List comments;
...
}
How can I achieve paging like this:
Post post = //Find the post.
return…
I want to change a column from a table to uppercase before using like and filtering what is the keyword in HQL?
here's my query
SELECT abc
FROM ABC abc
WHERE abc.id = ?
And upper(abc.description) like '%?%'
Thanks
I have the following setup:
@Entity
@IdClass(MemberAttributePk.class)
public class MemberAttribute {
@Id
@ManyToOne @JoinColumn(name="member_id")
protected Member member;
@Id
protected String name;
private String value;
…