HHH-14529 Add a common interface for JaxbEntity, JaxbMappedSuperclass and JaxbEntityListener

This commit is contained in:
Yoann Rodière 2021-03-26 15:47:03 +01:00
parent b4dd2e272f
commit 437af3b4da
3 changed files with 52 additions and 2 deletions

View File

@ -9,7 +9,7 @@ package org.hibernate.boot.jaxb.mapping.spi;
/**
* Common interface for JAXB bindings representing entities and mapped-superclasses.
*/
public interface EntityOrMappedSuperclass extends ManagedType {
public interface EntityOrMappedSuperclass extends ManagedType, LifecycleCallbackContainer {
JaxbIdClass getIdClass();

View File

@ -0,0 +1,45 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.boot.jaxb.mapping.spi;
public interface LifecycleCallbackContainer {
String getDescription();
void setDescription(String value);
JaxbPrePersist getPrePersist();
void setPrePersist(JaxbPrePersist value);
JaxbPostPersist getPostPersist();
void setPostPersist(JaxbPostPersist value);
JaxbPreRemove getPreRemove();
void setPreRemove(JaxbPreRemove value);
JaxbPostRemove getPostRemove();
void setPostRemove(JaxbPostRemove value);
JaxbPreUpdate getPreUpdate();
void setPreUpdate(JaxbPreUpdate value);
JaxbPostUpdate getPostUpdate();
void setPostUpdate(JaxbPostUpdate value);
JaxbPostLoad getPostLoad();
void setPostLoad(JaxbPostLoad value);
String getClazz();
void setClazz(String value);
}

View File

@ -100,6 +100,7 @@
<bindings node="//xsd:complexType[@name='entity']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.ManagedType</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.EntityOrMappedSuperclass</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.LifecycleCallbackContainer</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='embeddable']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.ManagedType</inheritance:implements>
@ -107,6 +108,11 @@
<bindings node="//xsd:complexType[@name='mapped-superclass']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.ManagedType</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.EntityOrMappedSuperclass</inheritance:implements>
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.LifecycleCallbackContainer</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='entity-listener']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.LifecycleCallbackContainer</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='id']">
@ -173,7 +179,6 @@
<bindings node="//xsd:complexType[@name='embeddable-attributes']">
<inheritance:implements>org.hibernate.boot.jaxb.mapping.spi.AttributesContainer</inheritance:implements>
</bindings>
</bindings>
<!-- All bindings need to be serializable for cached metadata sources. -->