EJB3 EntityManager Question...

G

grz01

Out of curiousity...
when you use the EntityManager in EJB3 to update existing db-records,
like for example:

...
EntityManager em = (EntityManager) ctx.lookup("java:comp/
env/...");
String sQL = "select c from Customer c where c.id=?1";
customer = (Customer)
entityManager.createQuery(sQL).setParameter(1, nId).getSingleResult();
customer.emailaddress = "...";

the last statement will somehow cause an SQL UPDATE-stmt to be sent to
the database.
When the Customer class is just an ordinary POJO (with some
annotations on it)
how does the EntityManager detect or get notified abt such
assignments?
What mechanism in Java is used to achieve this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top