I am sure that this is strongly related to this question , but the op on this question has a bit of a scenario that I am not sure even makes sense for the diatom so that’s what I understand, it’s usually not recommended to try to mix JPA Entity with CDI Bean because both are typically accomplished by creating proxy objects. Here is what I imagined, but from what I read, it is impossible.
@Entity
public class MyUniqueObject implements Serializable {
@Inject
private transient Logger log;
@Inject
private transient Event<MyUniqueObjectEvent> events;
@Id
private long id;
@NotNull
private String text;
public void setText( final String text ) {
log.debug( "updating text {}", this );
this.text = text;
events.fire( new MyUniqueObjectEvent( this ) );
}
}
What is the best way to do what I'm trying to accomplish? which is mainly related to events originating from objects that support JPA, access to journal objects. Code examples are helpful.
source
share