How can I store an object (entity) in memory to get it later only in a working application with Hibernate?
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@Column(name = "name")
private String name;
@Column(name = "password")
private String password;
//without save this to database but in memory
private boolean drunk;
}
How to get an object from memory with variable "drunk"?
I'm using now this to get object:
session.createQuery("SELECT u FROM User u WHERE u.name LIKE :name")
.setParameter("name", name)
.getResultList();