persist « EntityManager « JPA Q&A





1. Create Entity Manager without persistence.xml    stackoverflow.com

Is there a way to initialize the EntityManager without a persistence unit defined? Can you give all the required properties to create an entity manager? I need to create the EntityManager ...

2. Why use an entity manager?    stackoverflow.com

I am using Hibernate to map objects to entities and I have started to use an Entity Manager. This might be a silly question but what actually is the reason for ...

3. How to handle persistence context (EntityManager) with jax-rs sub-resource locators?    stackoverflow.com

I am using jax-rs restful web service in my application with sub-resource locators. However after passing entityManager to sub-resource I cannot persist any new objects in this sub-resource. The entityManager lets me ...

4. JPA EntityManager question    stackoverflow.com

I'm quite new to both JPA/Hibernate and to Java, and am having some trouble with the basics of using the EntityManager class to manage persistent objects. I would appreciate it ...

5. How can I receive the persistence unit name of an EntityManager?    stackoverflow.com

In a Java EE application I am using @PersistenceContext on an EJB3.0 SessionBean to let an EntityManager be autowired. As I am using multiple Datasources, I want to programmatically determine the ...

6. create hibernate config from entityManager    stackoverflow.com

using Hibernate, i had a class which setup a session with DB in such way:

Configuration hbConfig = new Configuration().configure(new File("hibernate.cfg.xml"));
SessionFactory sessionFactory  =  hbConfig.buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
session = sessionFactory.openSession();
session.beginTransaction();
Query query ...

7. Entitymanager.persist is failing in Informix UDR    stackoverflow.com

I am unable to understand the reason of failure in UDR here: while I am compiling the code on windows using Eclipse the programe is able to insert the record in informix ...

9. EntityManager + Oracle -> How can I persist a Blob?    forum.hibernate.org

So we used database reverse engineering to get our POJOs. That having been said, I have one that has a Blob in it. No annotation, just a java.sql.Blob object with a getter/setter. The implication is that I have to implement the java.sql.Blob interface and then set one of these in my Pojo. Surely there has to be a better way? Perhaps ...





10. EntityManager.persist() creates an unimplemented bag    forum.hibernate.org

@Test public void testUpdateWhole() throws Exception { Part part1 = new Part(); Part part2 = new Part(); Whole whole = new Whole(); whole.setParts(Arrays.asList(part1, part2)); ...

11. EntityManager.persist and JMS messaging problem?    forum.hibernate.org

Hi everyone: I am seeing a problem that I could not figure out a solution. Can anyone shed me some lights on this? I have a EJB method which basically does 2 things: 1). persists a record into a database table using EntityManager 2). sends out a message to a JMS topic. So it is th like: myMethod() { entityManager.persist(myObj); notifier.notify(...); ...

12. EntityManager.persist: What does/should it mean?    forum.hibernate.org

Hi! Lets say you are presented with the following JPA @Entity: Code: @Entity public class Customer { private Long id; private String name; @Id @GeneratedValue(strategy=GenerationType.AUTO) public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Column(nullable=false) public String getName() { return name; } public void setName(String name) { this.name = name; } } And then ...