After executing the following operation in my Seam/Glassfish/JPA container:
@ApplicationScoped
public class JpaGlossaryDataAccessObject implements IGlossaryDataAccessObject {
// ...
@Transactional
public void deleteColumn(String glossaryName, String columnName) {
final GlossaryColumn column = getColumn(glossaryName, columnName);
entityManager.remove(column);
}
// ...
}
the requested columns get successfully deleted from the DB, which I can verify using the SQL workbench. However, when calling the following method subsequently:
@ApplicationScoped
public class JpaGlossaryDataAccessObject implements IGlossaryDataAccessObject {
// ...
@Transactional
public List<Glossary> getGlossaries(Collection<String> glossaryNames) {
glossaryNames.retainAll(getGlossaryNames());
return entityManager.createQuery(SELECT_ALL_NAMED_GLOSSARIES, Glossary.class).setParameter(GLOSSARY_NAMES_PARAMETER_INDEX, glossaryNames).getResultList();
}
// ...
}
which basically returns the Glossaries containing aforesaid columns, the deleted column is still in the Glossary object! Even though they don't exist anymore in the database. How can this be? Is there some additional refresh I need to perform in order to make this work?
My beans.xml looks like this, by the way:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="urn:java:ee"
xmlns:security="urn:java:org.jboss.seam.security" xmlns:permission="urn:java:org.jboss.seam.security.permission"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
<alternatives />
<decorators />
<interceptors>
<class>org.jboss.seam.security.SecurityInterceptor</class>
<class>org.jboss.seam.transaction.TransactionInterceptor</class>
</interceptors>
<security:IdentityImpl>
<s:modifies />
<security:authenticatorClass>ch.diction.webportal.security.seam.authentication.ChallengeResponseIdmAuthenticatorDecorator
</security:authenticatorClass>
</security:IdentityImpl>
</beans>
So, what am I missing?
Thanks in advance and best regards Pascal