Sorry if this is a repost, I could not find the search terms to search for a similar question.
The application in which I work has support for plugins that can be loaded or unloaded at runtime. There are several API hooks that allow these plugins, among other things, to register richer objects than those provided out of the box. When the plugin is activated and registers a new domain object, I need to warn about sleep mode for the new object (and delete this object when the plugin is disabled). All our objects are marked with JPA / Hibernate annotations.
System class
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING)
@DiscriminatorValue("CORE")
public class User {
protected @Id @GeneratedValue int id;
protected String userName;
...
}
Plugin class (found in the JAR classloader)
@Entity
@DiscriminatorValue("LDAP_USER")
public class LdapUser extends User {
protected boolean active;
...
}
Plugin connection point API key
public void activate() {
UserManager.getInstance().registerType(LdapUser.class);
}
public void deactivate() {
UserManager.getInstance().unregisterType(LdapUser.class);
}
, hybernate API, , .
, : " ", Spring .