How can I get the session object if I have the entity-manager?

To be totally exhaustive, things are different if you’re using a JPA 1.0 or a JPA 2.0 implementation. JPA 1.0 With JPA 1.0, you’d have to use EntityManager#getDelegate(). But keep in mind that the result of this method is implementation specific i.e. non portable from application server using Hibernate to the other. For example with … Read more

Hibernate SessionFactory vs. JPA EntityManagerFactory

Prefer EntityManagerFactory and EntityManager. They are defined by the JPA standard. SessionFactory and Session are hibernate-specific. The EntityManager invokes the hibernate session under the hood. And if you need some specific features that are not available in the EntityManager, you can obtain the session by calling: Session session = entityManager.unwrap(Session.class);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)