Hibernate @EntityListener从未被wildlfy 10解雇
我有这样一个实体:Hibernate @EntityListener从未被wildlfy 10解雇,hibernate,jpa,jakarta-ee,wildfly,Hibernate,Jpa,Jakarta Ee,Wildfly,我有这样一个实体: @Entity @EntityListeners (Rserve.class) public class Example extends Analysis { private @Column @Basic int a; private @Column @Basic int b = 1; private @Column @Basic int c; //... } public class Rserve extends Agent <R> { /*
@Entity
@EntityListeners (Rserve.class)
public class Example extends Analysis {
private @Column @Basic int a;
private @Column @Basic int b = 1;
private @Column @Basic int c;
//...
}
public class Rserve extends Agent <R> { /* R is an annotation ... */ }
public abstract class Agent <E extends Annotation> {
{
System.out.println ("CREATING " + getClass ().getSimpleName ());
}
@PrePersist
@PreUpdate
@PreRemove
@PostPersist
@PostRemove
@PostLoad
@PostUpdate
public void cb (Object a) {
System.out.println ("CB(" + a + ")");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="mev" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.connection.url" value="jdbc:h2:mem:mev;DB_CLOSE_DELAY=-1" />
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"></property>
<property name="hibernate.connection.driver_class" value="org.h2.Driver" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.connection.release_mode" value="after_transaction" />
<property name="hibernate.connection.password" value="admin" />
<property name="hibernate.connection.username" value="admin" />
</properties>
</persistence-unit>
</persistence>
听众喜欢这样:
@Entity
@EntityListeners (Rserve.class)
public class Example extends Analysis {
private @Column @Basic int a;
private @Column @Basic int b = 1;
private @Column @Basic int c;
//...
}
public class Rserve extends Agent <R> { /* R is an annotation ... */ }
public abstract class Agent <E extends Annotation> {
{
System.out.println ("CREATING " + getClass ().getSimpleName ());
}
@PrePersist
@PreUpdate
@PreRemove
@PostPersist
@PostRemove
@PostLoad
@PostUpdate
public void cb (Object a) {
System.out.println ("CB(" + a + ")");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="mev" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.connection.url" value="jdbc:h2:mem:mev;DB_CLOSE_DELAY=-1" />
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"></property>
<property name="hibernate.connection.driver_class" value="org.h2.Driver" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.connection.release_mode" value="after_transaction" />
<property name="hibernate.connection.password" value="admin" />
<property name="hibernate.connection.username" value="admin" />
</properties>
</persistence-unit>
</persistence>
这似乎是一个Wildfly问题,它没有回调实体侦听器的超类。回调在放入监听器的具体类时工作良好,根据Klaus Groenbaek的说法,在Spring Boot中甚至在超类上也工作良好。这似乎是一个Wildfly问题,没有回调实体监听器的超类。回调在放入监听器的具体类时可以很好地工作,根据Klaus Groenbaek的说法,在Spring Boot中甚至在超类上也可以很好地工作。我不确定与监听器相关的注释是否可以在抽象类中,它应该根据我发现的其他资源和其他资源。不过,显然你是对的,bummer!我不确定那些与监听器相关的注释是否可以是一个抽象的类,它应该是根据我发现的其他资源,显然你是对的,笨蛋!