/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.source.binder;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import org.hibernate.internal.jaxb.Origin;
import org.hibernate.metamodel.binding.CustomSQL;
import org.hibernate.metamodel.source.LocalBindingContext;
Contract describing source of an entity
Author: Steve Ebersole
/**
* Contract describing source of an entity
*
* @author Steve Ebersole
*/
public interface EntitySource extends SubclassEntityContainer, AttributeSourceContainer {
Obtain the origin of this source.
Returns: The origin of this source.
/**
* Obtain the origin of this source.
*
* @return The origin of this source.
*/
public Origin getOrigin();
Obtain the binding context local to this entity source.
Returns: The local binding context
/**
* Obtain the binding context local to this entity source.
*
* @return The local binding context
*/
public LocalBindingContext getLocalBindingContext();
Obtain the entity name
Returns: The entity name
/**
* Obtain the entity name
*
* @return The entity name
*/
public String getEntityName();
Obtain the name of the entity Class
Returns: THe entity class name
/**
* Obtain the name of the entity {@link Class}
*
* @return THe entity class name
*/
public String getClassName();
Obtain the JPA name of the entity
Returns: THe JPA-specific entity name
/**
* Obtain the JPA name of the entity
*
* @return THe JPA-specific entity name
*/
public String getJpaEntityName();
Obtain the primary table for this entity.
Returns: The primary table.
/**
* Obtain the primary table for this entity.
*
* @return The primary table.
*/
public TableSource getPrimaryTable();
Obtain the secondary tables for this entity
Returns: returns an iterator over the secondary tables for this entity
/**
* Obtain the secondary tables for this entity
*
* @return returns an iterator over the secondary tables for this entity
*/
public Iterable<TableSource> getSecondaryTables();
Obtain the name of a custom tuplizer class to be used.
Returns: The custom tuplizer class name
/**
* Obtain the name of a custom tuplizer class to be used.
*
* @return The custom tuplizer class name
*/
public String getCustomTuplizerClassName();
Obtain the name of a custom persister class to be used.
Returns: The custom persister class name
/**
* Obtain the name of a custom persister class to be used.
*
* @return The custom persister class name
*/
public String getCustomPersisterClassName();
Is this entity lazy (proxyable)?
Returns: true
indicates the entity is lazy; false
non-lazy.
/**
* Is this entity lazy (proxyable)?
*
* @return {@code true} indicates the entity is lazy; {@code false} non-lazy.
*/
public boolean isLazy();
For lazy
entities, obtain the interface to use in constructing its proxies. Returns: The proxy interface name
/**
* For {@link #isLazy() lazy} entities, obtain the interface to use in constructing its proxies.
*
* @return The proxy interface name
*/
public String getProxy();
Obtain the batch-size to be applied when initializing proxies of this entity.
Returns: returns the the batch-size.
/**
* Obtain the batch-size to be applied when initializing proxies of this entity.
*
* @return returns the the batch-size.
*/
public int getBatchSize();
Is the entity abstract?
The implication is whether the entity maps to a database table.
Returns: true
indicates the entity is abstract; false
non-abstract.
/**
* Is the entity abstract?
* <p/>
* The implication is whether the entity maps to a database table.
*
* @return {@code true} indicates the entity is abstract; {@code false} non-abstract.
*/
public boolean isAbstract();
Did the source specify dynamic inserts?
Returns: true
indicates dynamic inserts will be used; false
otherwise.
/**
* Did the source specify dynamic inserts?
*
* @return {@code true} indicates dynamic inserts will be used; {@code false} otherwise.
*/
public boolean isDynamicInsert();
Did the source specify dynamic updates?
Returns: true
indicates dynamic updates will be used; false
otherwise.
/**
* Did the source specify dynamic updates?
*
* @return {@code true} indicates dynamic updates will be used; {@code false} otherwise.
*/
public boolean isDynamicUpdate();
Did the source specify to perform selects to decide whether to perform (detached) updates?
Returns: true
indicates selects will be done; false
otherwise.
/**
* Did the source specify to perform selects to decide whether to perform (detached) updates?
*
* @return {@code true} indicates selects will be done; {@code false} otherwise.
*/
public boolean isSelectBeforeUpdate();
Obtain the name of a named-query that will be used for loading this entity
Returns: THe custom loader query name
/**
* Obtain the name of a named-query that will be used for loading this entity
*
* @return THe custom loader query name
*/
public String getCustomLoaderName();
Obtain the custom SQL to be used for inserts for this entity
Returns: The custom insert SQL
/**
* Obtain the custom SQL to be used for inserts for this entity
*
* @return The custom insert SQL
*/
public CustomSQL getCustomSqlInsert();
Obtain the custom SQL to be used for updates for this entity
Returns: The custom update SQL
/**
* Obtain the custom SQL to be used for updates for this entity
*
* @return The custom update SQL
*/
public CustomSQL getCustomSqlUpdate();
Obtain the custom SQL to be used for deletes for this entity
Returns: The custom delete SQL
/**
* Obtain the custom SQL to be used for deletes for this entity
*
* @return The custom delete SQL
*/
public CustomSQL getCustomSqlDelete();
Obtain any additional table names on which to synchronize (auto flushing) this entity.
Returns: Additional synchronized table names.
/**
* Obtain any additional table names on which to synchronize (auto flushing) this entity.
*
* @return Additional synchronized table names.
*/
public List<String> getSynchronizedTableNames();
Obtain the meta-attribute sources associated with this entity.
Returns: The meta-attribute sources.
/**
* Obtain the meta-attribute sources associated with this entity.
*
* @return The meta-attribute sources.
*/
public Iterable<MetaAttributeSource> metaAttributes();
Get the actual discriminator value in case of a single table inheritance
Returns: the actual discriminator value in case of a single table inheritance or null
in case there is no explicit value or a different inheritance scheme
/**
* Get the actual discriminator value in case of a single table inheritance
*
* @return the actual discriminator value in case of a single table inheritance or {@code null} in case there is no
* explicit value or a different inheritance scheme
*/
public String getDiscriminatorMatchValue();
Returns: returns the source information for constraints defined on the table
/**
* @return returns the source information for constraints defined on the table
*/
public Iterable<ConstraintSource> getConstraints();
Returns: the list of classes (this entity
/mapped superclass
, or entity listeners
) that define JPA callbacks for this entity/mapped superclass.
/**
* @return the list of classes (this {@link Entity entity}/{@link MappedSuperclass mapped superclass}, or
* {@link EntityListeners entity listeners}) that define JPA callbacks for this entity/mapped superclass.
*/
List<JpaCallbackClass> getJpaCallbackClasses();
}