Tags » Hibernate

Como recuperar o SessionFactory a partir de um EntityManager na JPA 1.0

Para recuperar o SessionFactory a partir do EntityManager, é preciso executar o metodo  getDelegate(), que tem por função retornar o JPA Provider, nesse caso é o Hibenate. 20 more words


Use Hibernate Query Language to Join Tables and Map Column Values to Java Objects

The following example creates a HQL statement with named parameters, executes the query then maps the query result back to Java objects. The two named parameters in the example are accountNumber and trackingId. 172 more words


How does Hibernate NONSTRICT_READ_WRITE CacheConcurrencyStrategy work


In my previous post, I introduced the READ_ONLY CacheConcurrencyStrategy, which is the obvious choice for immutable entity graphs. When cached data is changeable, we need to use a read-write caching strategy and this post will describe how… 780 more words


Hibernate : How to map boolean definitions column for postgreSQL?

@Column(name = "column_name", columnDefinition = "boolean default true")
private boolean columnName ;

To be able to hibernate in windows 8/8.1, you’ll need to first enable it unlike in the previous Windows Operating Systems (For this method you’ll need to have administrator privileges).


Hibernate validator example

package nl.kameroom.user;

import java.util.Date;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

public class BasicRegister {

	private int idAuthority;

	@Email (message = "2.email.format")
        @Length(min=1, max = 100, message="3.email.length") 
	private String email;

        @Length(min=1, max = 100, message="5.pass.length")  
	private String password;

        @Length(min=1, max = 100, message="7.firstname.length") 
	private String firstname;

        @Length(min=1, max = 100, message="9.lastname.length") 
	private String lastname;

        @Length(min= 1, max = 1, message="11.gender.length") 
	private String gender;

	public int getIdAuthority() {
		return idAuthority;
	public void setIdAuthority(int idAuthority) {
		this.idAuthority = idAuthority;

	public String getEmail() {
		return email;

	public void setEmail(String email) {
		this.email = email;

	public String getPassword() {
		return password;

	public void setPassword(String password) {
		this.password = password;

	public String getFirstname() {
		return firstname;

	public void setFirstname(String firstname) {
		this.firstname = firstname;

	public String getLastname() {
		return lastname;

	public void setLastname(String lastname) {
		this.lastname = lastname;

        public String getGender() {
		return gender;

	public void setGender(String gender) {
		this.gender = gender;



How does Hibernate Collection Cache work


Previously, I described the second-level cache entry structure, Hibernate uses for storing entities. Besides entities, Hibernate can also store entity associations and this article will unravel the inner workings of collection caching. 1,753 more words