entitymanager

How can I fetch every row where column is not in (array of values) with Doctrine?

I'm trying to accomplish something similar to the following SQL, but using the Doctrine API. SELECT * FROM table_name WHERE column_name NOT IN (1, 2, 3); I was thinking of something like this: $entityManager->getRepository($entity)->findBy(array('ID' => array('NOT IN' => array(1, 2, 3)))); ... How...

Why does 'EntityManager.contains(..)' return false even if an entity is contained in DB?

I used this JPA: check whether an entity object has been persisted or not to know if i persist or merge my entity , It will look like this : if (!getEntityManager().contains(entity)) { System.out.println(" PERSIST "); } else { System.out.println(" MERGE "); } The case is that - even if I edit my...

JPA - strange behavior using EntityManager remove() method

I am in a configuration (JTA - CMT) in which I have to remove an entity object after creating it. I use em.remove(object) after finding it, but remove doesn't work, or it seems to be not working. What happens is that the object I want and try, to remove is still in DB. Once the removal operation is...

How can use JPA with play 2.5 without creating a entitymanager factory for each of my different calls?

I'm working on a API with play 2.5 for an Oracle database. Now I'm trying to use the build in features for JPA in play. On this moment I get the error "No EntityManager bound to this thread. Try wrapping this call in JPAApi.withTransaction, or ensure that the HTTP context is setup on this thread." ....

Field values are not being modified on PreUpdate callback

I've defined the following class as as default Entity Listener, so every time I call the persist() or merge() methods this code will be executed automatically: public class StringProcessorListener { @PrePersist @PreUpdate public void formatStrings(Object object) { try { for (Field f : object...