HHH-6080: Created XSDs from existing mapping and configuration DTDs
This commit is contained in:
parent
1a40b0232f
commit
d631671761
|
@ -36,11 +36,11 @@ import org.hibernate.metamodel.domain.MetaAttribute;
|
|||
import org.hibernate.metamodel.relational.Column;
|
||||
import org.hibernate.metamodel.relational.TableSpecification;
|
||||
import org.hibernate.metamodel.source.hbm.HbmHelper;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLClass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlDelete;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlInsert;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlUpdate;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSynchronize;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlDeleteElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlInsertElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlUpdateElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSynchronizeElement;
|
||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||
|
||||
/**
|
||||
|
@ -92,12 +92,12 @@ public class EntityBinding {
|
|||
metaAttributes = HbmHelper.extractMetas( entityClazz.getMeta(), true, defaults.getMappingMetas() );
|
||||
|
||||
// go ahead and set the lazy here, since pojo.proxy can override it.
|
||||
lazy = MappingHelper.getBooleanValue( entityClazz.getLazy(), defaults.isDefaultLazy() );
|
||||
lazy = MappingHelper.getBooleanValue( entityClazz.isLazy(), defaults.isDefaultLazy() );
|
||||
discriminatorValue = MappingHelper.getStringValue( entityClazz.getDiscriminatorValue(), entity.getName() );
|
||||
dynamicUpdate = MappingHelper.getBooleanValue( entityClazz.getDynamicUpdate(), false );
|
||||
dynamicInsert = MappingHelper.getBooleanValue( entityClazz.getDynamicInsert(), false );
|
||||
dynamicUpdate = entityClazz.isDynamicUpdate();
|
||||
dynamicInsert = entityClazz.isDynamicInsert();
|
||||
batchSize = MappingHelper.getIntValue( entityClazz.getBatchSize(), 0 );
|
||||
selectBeforeUpdate = MappingHelper.getBooleanValue( entityClazz.getSelectBeforeUpdate(), false );
|
||||
selectBeforeUpdate = entityClazz.isSelectBeforeUpdate();
|
||||
|
||||
// OPTIMISTIC LOCK MODE
|
||||
String optimisticLockModeString = MappingHelper.getStringValue( entityClazz.getOptimisticLock(), "version" );
|
||||
|
@ -129,40 +129,40 @@ public class EntityBinding {
|
|||
}
|
||||
|
||||
// CUSTOM SQL
|
||||
XMLSqlInsert sqlInsert = entityClazz.getSqlInsert();
|
||||
XMLSqlInsertElement sqlInsert = entityClazz.getSqlInsert();
|
||||
if ( sqlInsert != null ) {
|
||||
customInsert = HbmHelper.getCustomSql(
|
||||
sqlInsert.getContent(),
|
||||
MappingHelper.getBooleanValue( sqlInsert.getCallable(), false ),
|
||||
sqlInsert.getCheck()
|
||||
sqlInsert.getValue(),
|
||||
sqlInsert.isCallable(),
|
||||
sqlInsert.getCheck().value()
|
||||
);
|
||||
}
|
||||
|
||||
XMLSqlDelete sqlDelete = entityClazz.getSqlDelete();
|
||||
XMLSqlDeleteElement sqlDelete = entityClazz.getSqlDelete();
|
||||
if ( sqlDelete != null ) {
|
||||
customDelete = HbmHelper.getCustomSql(
|
||||
sqlDelete.getContent(),
|
||||
MappingHelper.getBooleanValue( sqlDelete.getCallable(), false ),
|
||||
sqlDelete.getCheck()
|
||||
sqlDelete.getValue(),
|
||||
sqlDelete.isCallable(),
|
||||
sqlDelete.getCheck().value()
|
||||
);
|
||||
}
|
||||
|
||||
XMLSqlUpdate sqlUpdate = entityClazz.getSqlUpdate();
|
||||
XMLSqlUpdateElement sqlUpdate = entityClazz.getSqlUpdate();
|
||||
if ( sqlUpdate != null ) {
|
||||
customUpdate = HbmHelper.getCustomSql(
|
||||
sqlUpdate.getContent(),
|
||||
MappingHelper.getBooleanValue( sqlUpdate.getCallable(), false ),
|
||||
sqlUpdate.getCheck()
|
||||
sqlUpdate.getValue(),
|
||||
sqlUpdate.isCallable(),
|
||||
sqlUpdate.getCheck().value()
|
||||
);
|
||||
}
|
||||
|
||||
if ( entityClazz.getSynchronize() != null ) {
|
||||
for ( XMLSynchronize synchronize : entityClazz.getSynchronize() ) {
|
||||
for ( XMLSynchronizeElement synchronize : entityClazz.getSynchronize() ) {
|
||||
addSynchronizedTable( synchronize.getTable() );
|
||||
}
|
||||
}
|
||||
|
||||
isAbstract = MappingHelper.getBooleanValue( entityClazz.getAbstract(), false );
|
||||
isAbstract = entityClazz.isAbstract();
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
|
|
|
@ -47,11 +47,36 @@ import org.hibernate.metamodel.relational.Schema;
|
|||
import org.hibernate.metamodel.relational.Table;
|
||||
import org.hibernate.metamodel.relational.TableSpecification;
|
||||
import org.hibernate.metamodel.relational.UniqueKey;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.*;
|
||||
import org.hibernate.metamodel.source.internal.MetadataImpl;
|
||||
import org.hibernate.metamodel.source.hbm.state.domain.HbmPluralAttributeDomainState;
|
||||
import org.hibernate.metamodel.source.hbm.state.domain.HbmSimpleAttributeDomainState;
|
||||
import org.hibernate.metamodel.source.hbm.state.relational.HbmSimpleValueRelationalStateContainer;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLAnyElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLBagElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLComponentElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLDynamicComponentElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLFilterElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLTimestamp;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLVersion;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLIdbagElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLJoinElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLJoinedSubclassElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLListElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLMapElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLOneToOneElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertiesElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLQueryElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLResultsetElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSetElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlQueryElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSubclassElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLTuplizerElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLUnionSubclassElement;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
|
@ -141,7 +166,7 @@ abstract class AbstractEntityBinder {
|
|||
entityBinding.getEntity().getPojoEntitySpecifics().setProxyInterfaceName( className );
|
||||
}
|
||||
|
||||
XMLTuplizer tuplizer = locateTuplizerDefinition( entityClazz, EntityMode.POJO );
|
||||
XMLTuplizerElement tuplizer = locateTuplizerDefinition( entityClazz, EntityMode.POJO );
|
||||
if ( tuplizer != null ) {
|
||||
entityBinding.getEntity().getPojoEntitySpecifics().setTuplizerClassName( tuplizer.getClazz() );
|
||||
}
|
||||
|
@ -155,7 +180,7 @@ abstract class AbstractEntityBinder {
|
|||
}
|
||||
entityBinding.getEntity().getDom4jEntitySpecifics().setNodeName(nodeName);
|
||||
|
||||
XMLTuplizer tuplizer = locateTuplizerDefinition( entityClazz, EntityMode.DOM4J );
|
||||
XMLTuplizerElement tuplizer = locateTuplizerDefinition( entityClazz, EntityMode.DOM4J );
|
||||
if ( tuplizer != null ) {
|
||||
entityBinding.getEntity().getDom4jEntitySpecifics().setTuplizerClassName( tuplizer.getClazz() );
|
||||
}
|
||||
|
@ -163,7 +188,7 @@ abstract class AbstractEntityBinder {
|
|||
|
||||
private void bindMapRepresentation(XMLClass entityClazz,
|
||||
EntityBinding entityBinding) {
|
||||
XMLTuplizer tuplizer = locateTuplizerDefinition( entityClazz, EntityMode.MAP );
|
||||
XMLTuplizerElement tuplizer = locateTuplizerDefinition( entityClazz, EntityMode.MAP );
|
||||
if ( tuplizer != null ) {
|
||||
entityBinding.getEntity().getMapEntitySpecifics().setTuplizerClassName( tuplizer.getClazz() );
|
||||
}
|
||||
|
@ -177,9 +202,9 @@ abstract class AbstractEntityBinder {
|
|||
*
|
||||
* @return The tuplizer element, or null.
|
||||
*/
|
||||
private static XMLTuplizer locateTuplizerDefinition(XMLClass container,
|
||||
private static XMLTuplizerElement locateTuplizerDefinition(XMLClass container,
|
||||
EntityMode entityMode) {
|
||||
for ( XMLTuplizer tuplizer : container.getTuplizer() ) {
|
||||
for ( XMLTuplizerElement tuplizer : container.getTuplizer() ) {
|
||||
if ( entityMode.toString().equals( tuplizer.getEntityMode() ) ) {
|
||||
return tuplizer;
|
||||
}
|
||||
|
@ -260,67 +285,67 @@ abstract class AbstractEntityBinder {
|
|||
|
||||
AttributeBinding attributeBinding = null;
|
||||
for ( Object attribute : entityClazz.getPropertyOrManyToOneOrOneToOne() ) {
|
||||
if ( XMLBag.class.isInstance( attribute ) ) {
|
||||
XMLBag collection = XMLBag.class.cast( attribute );
|
||||
if ( XMLBagElement.class.isInstance( attribute ) ) {
|
||||
XMLBagElement collection = XMLBagElement.class.cast( attribute );
|
||||
BagBinding collectionBinding = entityBinding.makeBagAttributeBinding( collection.getName() );
|
||||
bindBag( collection, collectionBinding, entityBinding );
|
||||
hibernateMappingBinder.getHibernateXmlBinder().getMetadata().addCollection( collectionBinding );
|
||||
attributeBinding = collectionBinding;
|
||||
}
|
||||
else if ( XMLIdbag.class.isInstance( attribute ) ) {
|
||||
XMLIdbag collection = XMLIdbag.class.cast( attribute );
|
||||
else if ( XMLIdbagElement.class.isInstance( attribute ) ) {
|
||||
XMLIdbagElement collection = XMLIdbagElement.class.cast( attribute );
|
||||
//BagBinding collectionBinding = entityBinding.makeBagAttributeBinding( collection.getName() );
|
||||
//bindIdbag( collection, bagBinding, entityBinding, PluralAttributeNature.BAG, collection.getName() );
|
||||
// todo: handle identifier
|
||||
//attributeBinding = collectionBinding;
|
||||
//hibernateMappingBinder.getHibernateXmlBinder().getMetadata().addCollection( attributeBinding );
|
||||
}
|
||||
else if ( XMLSet.class.isInstance( attribute ) ) {
|
||||
XMLSet collection = XMLSet.class.cast( attribute );
|
||||
else if ( XMLSetElement.class.isInstance( attribute ) ) {
|
||||
XMLSetElement collection = XMLSetElement.class.cast( attribute );
|
||||
//BagBinding collectionBinding = entityBinding.makeBagAttributeBinding( collection.getName() );
|
||||
//bindSet( collection, collectionBinding, entityBinding, PluralAttributeNature.SET, collection.getName() );
|
||||
//attributeBinding = collectionBinding;
|
||||
//hibernateMappingBinder.getHibernateXmlBinder().getMetadata().addCollection( attributeBinding );
|
||||
}
|
||||
else if ( XMLList.class.isInstance( attribute ) ) {
|
||||
XMLList collection = XMLList.class.cast( attribute );
|
||||
else if ( XMLListElement.class.isInstance( attribute ) ) {
|
||||
XMLListElement collection = XMLListElement.class.cast( attribute );
|
||||
//ListBinding collectionBinding = entityBinding.makeBagAttributeBinding( collection.getName() );
|
||||
//bindList( collection, bagBinding, entityBinding, PluralAttributeNature.LIST, collection.getName() );
|
||||
// todo : handle list index
|
||||
//attributeBinding = collectionBinding;
|
||||
//hibernateMappingBinder.getHibernateXmlBinder().getMetadata().addCollection( attributeBinding );
|
||||
}
|
||||
else if ( XMLMap.class.isInstance( attribute ) ) {
|
||||
XMLMap collection = XMLMap.class.cast( attribute );
|
||||
else if ( XMLMapElement.class.isInstance( attribute ) ) {
|
||||
XMLMapElement collection = XMLMapElement.class.cast( attribute );
|
||||
//BagBinding bagBinding = entityBinding.makeBagAttributeBinding( collection.getName() );
|
||||
//bindMap( collection, bagBinding, entityBinding, PluralAttributeNature.MAP, collection.getName() );
|
||||
// todo : handle map key
|
||||
//hibernateMappingBinder.getHibernateXmlBinder().getMetadata().addCollection( attributeBinding );
|
||||
}
|
||||
else if ( XMLManyToOne.class.isInstance( attribute ) ) {
|
||||
else if ( XMLManyToOneElement.class.isInstance( attribute ) ) {
|
||||
// todo : implement
|
||||
// value = new ManyToOne( mappings, table );
|
||||
// bindManyToOne( subElement, (ManyToOne) value, propertyName, nullable, mappings );
|
||||
}
|
||||
else if ( XMLAny.class.isInstance( attribute ) ) {
|
||||
else if ( XMLAnyElement.class.isInstance( attribute ) ) {
|
||||
// todo : implement
|
||||
// value = new Any( mappings, table );
|
||||
// bindAny( subElement, (Any) value, nullable, mappings );
|
||||
}
|
||||
else if ( XMLOneToOne.class.isInstance( attribute ) ) {
|
||||
else if ( XMLOneToOneElement.class.isInstance( attribute ) ) {
|
||||
// todo : implement
|
||||
// value = new OneToOne( mappings, table, persistentClass );
|
||||
// bindOneToOne( subElement, (OneToOne) value, propertyName, true, mappings );
|
||||
}
|
||||
else if ( XMLProperty.class.isInstance( attribute ) ) {
|
||||
XMLProperty property = XMLProperty.class.cast( attribute );
|
||||
else if ( XMLPropertyElement.class.isInstance( attribute ) ) {
|
||||
XMLPropertyElement property = XMLPropertyElement.class.cast( attribute );
|
||||
SimpleAttributeBinding binding = entityBinding.makeSimpleAttributeBinding( property.getName() );
|
||||
bindSimpleAttribute( property, binding, entityBinding );
|
||||
attributeBinding = binding;
|
||||
}
|
||||
else if ( XMLComponent.class.isInstance( attribute )
|
||||
|| XMLDynamicComponent.class.isInstance( attribute )
|
||||
|| XMLProperties.class.isInstance( attribute ) ) {
|
||||
else if ( XMLComponentElement.class.isInstance( attribute )
|
||||
|| XMLDynamicComponentElement.class.isInstance( attribute )
|
||||
|| XMLPropertiesElement.class.isInstance( attribute ) ) {
|
||||
// todo : implement
|
||||
// String subpath = StringHelper.qualify( entityName, propertyName );
|
||||
// value = new Component( mappings, persistentClass );
|
||||
|
@ -344,26 +369,26 @@ abstract class AbstractEntityBinder {
|
|||
Array
|
||||
PrimitiveArray
|
||||
*/
|
||||
for ( XMLJoin join : entityClazz.getJoin() ) {
|
||||
for ( XMLJoinElement join : entityClazz.getJoin() ) {
|
||||
// todo : implement
|
||||
// Join join = new Join();
|
||||
// join.setPersistentClass( persistentClass );
|
||||
// bindJoin( subElement, join, mappings, inheritedMetas );
|
||||
// persistentClass.addJoin( join );
|
||||
}
|
||||
for ( XMLSubclass subclass : entityClazz.getSubclass() ) {
|
||||
for ( XMLSubclassElement subclass : entityClazz.getSubclass() ) {
|
||||
// todo : implement
|
||||
// handleSubclass( persistentClass, mappings, subElement, inheritedMetas );
|
||||
}
|
||||
for ( XMLJoinedSubclass subclass : entityClazz.getJoinedSubclass() ) {
|
||||
for ( XMLJoinedSubclassElement subclass : entityClazz.getJoinedSubclass() ) {
|
||||
// todo : implement
|
||||
// handleJoinedSubclass( persistentClass, mappings, subElement, inheritedMetas );
|
||||
}
|
||||
for ( XMLUnionSubclass subclass : entityClazz.getUnionSubclass() ) {
|
||||
for ( XMLUnionSubclassElement subclass : entityClazz.getUnionSubclass() ) {
|
||||
// todo : implement
|
||||
// handleUnionSubclass( persistentClass, mappings, subElement, inheritedMetas );
|
||||
}
|
||||
for ( XMLFilter filter : entityClazz.getFilter() ) {
|
||||
for ( XMLFilterElement filter : entityClazz.getFilter() ) {
|
||||
// todo : implement
|
||||
// parseFilter( subElement, entityBinding );
|
||||
}
|
||||
|
@ -388,18 +413,18 @@ PrimitiveArray
|
|||
}
|
||||
if ( entityClazz.getQueryOrSqlQuery() != null ) {
|
||||
for ( Object queryOrSqlQuery : entityClazz.getQueryOrSqlQuery() ) {
|
||||
if ( XMLQuery.class.isInstance( queryOrSqlQuery ) ) {
|
||||
if ( XMLQueryElement.class.isInstance( queryOrSqlQuery ) ) {
|
||||
// todo : implement
|
||||
// bindNamedQuery(subElement, persistentClass.getEntityName(), mappings);
|
||||
}
|
||||
else if ( XMLSqlQuery.class.isInstance( queryOrSqlQuery ) ) {
|
||||
else if ( XMLSqlQueryElement.class.isInstance( queryOrSqlQuery ) ) {
|
||||
// todo : implement
|
||||
// bindNamedSQLQuery(subElement, persistentClass.getEntityName(), mappings);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( entityClazz.getResultset() != null ) {
|
||||
for ( XMLResultset resultSet : entityClazz.getResultset() ) {
|
||||
for ( XMLResultsetElement resultSet : entityClazz.getResultset() ) {
|
||||
// todo : implement
|
||||
// bindResultSetMappingDefinition( subElement, persistentClass.getEntityName(), mappings );
|
||||
}
|
||||
|
@ -527,7 +552,7 @@ PrimitiveArray
|
|||
}
|
||||
}
|
||||
|
||||
protected void bindSimpleAttribute(XMLProperty property,
|
||||
protected void bindSimpleAttribute(XMLPropertyElement property,
|
||||
SimpleAttributeBinding attributeBinding,
|
||||
EntityBinding entityBinding) {
|
||||
if ( attributeBinding.getAttribute() == null ) {
|
||||
|
@ -555,7 +580,7 @@ PrimitiveArray
|
|||
}
|
||||
|
||||
protected void bindBag(
|
||||
XMLBag collection,
|
||||
XMLBagElement collection,
|
||||
PluralAttributeBinding collectionBinding,
|
||||
EntityBinding entityBinding) {
|
||||
if ( collectionBinding.getAttribute() == null ) {
|
||||
|
|
|
@ -34,8 +34,8 @@ import org.hibernate.MappingException;
|
|||
import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
|
||||
import org.hibernate.metamodel.binding.CustomSQL;
|
||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLClass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLMeta;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLMetaElement;
|
||||
import org.hibernate.metamodel.source.util.DomHelper;
|
||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||
|
||||
|
@ -69,15 +69,15 @@ public class HbmHelper {
|
|||
return ExecuteUpdateResultCheckStyle.parse( check );
|
||||
}
|
||||
|
||||
public static final Map<String, MetaAttribute> extractMetas(List<XMLMeta> meta, Map<String, MetaAttribute> baseline) {
|
||||
public static final Map<String, MetaAttribute> extractMetas(List<XMLMetaElement> meta, Map<String, MetaAttribute> baseline) {
|
||||
return extractMetas( meta, false, baseline );
|
||||
}
|
||||
|
||||
public static final Map<String, MetaAttribute> extractMetas(List<XMLMeta> metaList, boolean onlyInheritable, Map<String, MetaAttribute> baseline) {
|
||||
public static final Map<String, MetaAttribute> extractMetas(List<XMLMetaElement> metaList, boolean onlyInheritable, Map<String, MetaAttribute> baseline) {
|
||||
Map<String, MetaAttribute> extractedMetas = new HashMap<String, MetaAttribute>();
|
||||
extractedMetas.putAll( baseline );
|
||||
for ( XMLMeta meta : metaList) {
|
||||
boolean inheritable = Boolean.valueOf( meta.getInherit() );
|
||||
for ( XMLMetaElement meta : metaList) {
|
||||
boolean inheritable = meta.isInherit();
|
||||
if ( onlyInheritable & !inheritable ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class HbmHelper {
|
|||
metaAttribute = new MetaAttribute( name );
|
||||
extractedMetas.put( name, metaAttribute );
|
||||
}
|
||||
metaAttribute.addValue( meta.getContent() );
|
||||
metaAttribute.addValue( meta.getValue() );
|
||||
}
|
||||
return extractedMetas;
|
||||
}
|
||||
|
|
|
@ -36,16 +36,16 @@ import org.hibernate.metamodel.binding.MappingDefaults;
|
|||
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||
import org.hibernate.metamodel.source.Origin;
|
||||
import org.hibernate.metamodel.source.internal.JaxbRoot;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLClass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLFetch;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLFetchProfile;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLFetchProfileElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLFetchProfileElement.XMLFetch;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLImport;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLJoinedSubclass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLQuery;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlQuery;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSubclass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLUnionSubclass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLImport;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLJoinedSubclassElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLQueryElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlQueryElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSubclassElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLUnionSubclassElement;
|
||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||
|
||||
/**
|
||||
|
@ -76,10 +76,9 @@ class HibernateMappingBinder implements MappingDefaults {
|
|||
defaultCatalogName = hibernateMapping.getCatalog();
|
||||
defaultCascade = MappingHelper.getStringValue( hibernateMapping.getDefaultCascade(), "none" );
|
||||
defaultAccess = MappingHelper.getStringValue( hibernateMapping.getDefaultAccess(), "property" );
|
||||
//TODO: shouldn't default-lazy default to true???
|
||||
defaultLazy = MappingHelper.getBooleanValue( hibernateMapping.getDefaultLazy(), false );
|
||||
defaultLazy = hibernateMapping.isDefaultLazy();
|
||||
packageName = hibernateMapping.getPackage();
|
||||
autoImport = MappingHelper.getBooleanValue( hibernateMapping.getAutoImport(), false );
|
||||
autoImport = hibernateMapping.isAutoImport();
|
||||
|
||||
mappingMetas = HbmHelper.extractMetas( hibernateMapping.getMeta(), true, hibernateXmlBinder.getGlobalMetas() );
|
||||
}
|
||||
|
@ -152,15 +151,15 @@ class HibernateMappingBinder implements MappingDefaults {
|
|||
XMLClass.class.cast( clazzOrSubclass );
|
||||
new RootEntityBinder( this, clazz ).process( clazz );
|
||||
}
|
||||
else if ( XMLSubclass.class.isInstance( clazzOrSubclass ) ) {
|
||||
else if ( XMLSubclassElement.class.isInstance( clazzOrSubclass ) ) {
|
||||
// PersistentClass superModel = getSuperclass( mappings, element );
|
||||
// handleSubclass( superModel, mappings, element, inheritedMetas );
|
||||
}
|
||||
else if ( XMLJoinedSubclass.class.isInstance( clazzOrSubclass ) ) {
|
||||
else if ( XMLJoinedSubclassElement.class.isInstance( clazzOrSubclass ) ) {
|
||||
// PersistentClass superModel = getSuperclass( mappings, element );
|
||||
// handleJoinedSubclass( superModel, mappings, element, inheritedMetas );
|
||||
}
|
||||
else if ( XMLUnionSubclass.class.isInstance( clazzOrSubclass ) ) {
|
||||
else if ( XMLUnionSubclassElement.class.isInstance( clazzOrSubclass ) ) {
|
||||
// PersistentClass superModel = getSuperclass( mappings, element );
|
||||
// handleUnionSubclass( superModel, mappings, element, inheritedMetas );
|
||||
}
|
||||
|
@ -173,10 +172,10 @@ class HibernateMappingBinder implements MappingDefaults {
|
|||
}
|
||||
if ( hibernateMapping.getQueryOrSqlQuery() != null ) {
|
||||
for ( Object queryOrSqlQuery : hibernateMapping.getQueryOrSqlQuery() ) {
|
||||
if ( XMLQuery.class.isInstance( queryOrSqlQuery ) ) {
|
||||
if ( XMLQueryElement.class.isInstance( queryOrSqlQuery ) ) {
|
||||
// bindNamedQuery( element, null, mappings );
|
||||
}
|
||||
else if ( XMLSqlQuery.class.isInstance( queryOrSqlQuery ) ) {
|
||||
else if ( XMLSqlQueryElement.class.isInstance( queryOrSqlQuery ) ) {
|
||||
// bindNamedSQLQuery( element, null, mappings );
|
||||
}
|
||||
else {
|
||||
|
@ -206,8 +205,8 @@ class HibernateMappingBinder implements MappingDefaults {
|
|||
}
|
||||
}
|
||||
|
||||
protected void parseFetchProfiles(List<XMLFetchProfile> fetchProfiles, String containingEntityName) {
|
||||
for ( XMLFetchProfile fetchProfile : fetchProfiles ) {
|
||||
protected void parseFetchProfiles(List<XMLFetchProfileElement> fetchProfiles, String containingEntityName) {
|
||||
for ( XMLFetchProfileElement fetchProfile : fetchProfiles ) {
|
||||
String profileName = fetchProfile.getName();
|
||||
org.hibernate.metamodel.binding.FetchProfile profile = hibernateXmlBinder.getMetadata().findOrCreateFetchProfile( profileName, MetadataSource.HBM );
|
||||
for ( XMLFetch fetch : fetchProfile.getFetch() ) {
|
||||
|
|
|
@ -33,10 +33,10 @@ import org.hibernate.metamodel.relational.Column;
|
|||
import org.hibernate.metamodel.relational.Identifier;
|
||||
import org.hibernate.metamodel.relational.InLineView;
|
||||
import org.hibernate.metamodel.relational.Schema;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLCache;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLClass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLCompositeId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLCacheElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLCompositeId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId;
|
||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||
|
||||
/**
|
||||
|
@ -60,9 +60,7 @@ class RootEntityBinder extends AbstractEntityBinder {
|
|||
basicEntityBinding( xmlClazz, entityBinding, null );
|
||||
basicTableBinding( xmlClazz, entityBinding );
|
||||
|
||||
if ( xmlClazz.getMutable() != null ) {
|
||||
entityBinding.setMutable( Boolean.valueOf( xmlClazz.getMutable() ) );
|
||||
}
|
||||
entityBinding.setMutable( xmlClazz.isMutable() );
|
||||
|
||||
if ( xmlClazz.getWhere() != null ) {
|
||||
entityBinding.setWhereFilter( xmlClazz.getWhere() );
|
||||
|
@ -92,7 +90,7 @@ class RootEntityBinder extends AbstractEntityBinder {
|
|||
final Schema schema = getHibernateXmlBinder().getMetadata().getDatabase().getSchema( getSchemaName() );
|
||||
|
||||
final String subSelect =
|
||||
xmlClazz.getSubselect() == null ? xmlClazz.getSubselectElement() : xmlClazz.getSubselect();
|
||||
xmlClazz.getSubselectAttribute() == null ? xmlClazz.getSubselect() : xmlClazz.getSubselectAttribute();
|
||||
if ( subSelect != null ) {
|
||||
final String logicalName = entityBinding.getEntity().getName();
|
||||
InLineView inLineView = schema.getInLineView( logicalName );
|
||||
|
@ -241,7 +239,7 @@ class RootEntityBinder extends AbstractEntityBinder {
|
|||
// Handle the relational portion of the binding...
|
||||
bindSimpleAttribute( xmlEntityClazz.getDiscriminator(), discriminatorBinding, entityBinding, RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME );
|
||||
|
||||
entityBinding.getEntityDiscriminator().setForced( MappingHelper.getBooleanValue( xmlEntityClazz.getDiscriminator().getForce(), false ) );
|
||||
entityBinding.getEntityDiscriminator().setForced(xmlEntityClazz.getDiscriminator().isForce());
|
||||
}
|
||||
|
||||
private void bindVersion(XMLClass xmlEntityClazz,
|
||||
|
@ -276,7 +274,7 @@ class RootEntityBinder extends AbstractEntityBinder {
|
|||
|
||||
private void bindCaching(XMLClass xmlClazz,
|
||||
EntityBinding entityBinding) {
|
||||
XMLCache cache = xmlClazz.getCache();
|
||||
XMLCacheElement cache = xmlClazz.getCache();
|
||||
if ( cache == null ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -32,12 +32,12 @@ import org.hibernate.metamodel.binding.MappingDefaults;
|
|||
import org.hibernate.metamodel.domain.Attribute;
|
||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||
import org.hibernate.metamodel.source.hbm.HbmHelper;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLBag;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLDiscriminator;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLProperty;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLTimestamp;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLVersion;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLBagElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLTimestamp;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLVersion;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ public abstract class AbstractHbmAttributeDomainState implements AbstractAttribu
|
|||
this.defaults = defaults;
|
||||
this.attribute = attribute;
|
||||
this.hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||
this.hibernateTypeDescriptor.setTypeName( id.getType() );
|
||||
this.hibernateTypeDescriptor.setTypeName( id.getTypeAttribute() );
|
||||
this.accessorName = HbmHelper.getPropertyAccessorName(
|
||||
id.getAccess(), isEmbedded(), defaults.getDefaultAccess()
|
||||
);
|
||||
|
@ -130,24 +130,24 @@ public abstract class AbstractHbmAttributeDomainState implements AbstractAttribu
|
|||
public AbstractHbmAttributeDomainState(MappingDefaults defaults,
|
||||
Attribute attribute,
|
||||
Map<String, MetaAttribute> entityMetaAttributes,
|
||||
XMLProperty property) {
|
||||
XMLPropertyElement property) {
|
||||
this.defaults = defaults;
|
||||
this.attribute = attribute;
|
||||
this.hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||
this.hibernateTypeDescriptor.setTypeName( property.getType() );
|
||||
this.hibernateTypeDescriptor.setTypeName( property.getTypeAttribute() );
|
||||
this.accessorName = HbmHelper.getPropertyAccessorName(
|
||||
property.getAccess(), isEmbedded(), defaults.getDefaultAccess()
|
||||
);
|
||||
this.nodeName = MappingHelper.getStringValue( property.getNode(), attribute.getName() );
|
||||
this.metaAttributes = HbmHelper.extractMetas( property.getMeta(), entityMetaAttributes );
|
||||
this.cascade = defaults.getDefaultCascade();
|
||||
this.isOptimisticLockable = MappingHelper.getBooleanValue( property.getOptimisticLock(), true );
|
||||
this.isOptimisticLockable = property.isOptimisticLock();
|
||||
}
|
||||
|
||||
public AbstractHbmAttributeDomainState(MappingDefaults defaults,
|
||||
Attribute attribute,
|
||||
Map<String, MetaAttribute> entityMetaAttributes,
|
||||
XMLBag collection) {
|
||||
XMLBagElement collection) {
|
||||
this.defaults = defaults;
|
||||
this.attribute = attribute;
|
||||
this.hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||
|
@ -159,7 +159,7 @@ public abstract class AbstractHbmAttributeDomainState implements AbstractAttribu
|
|||
this.nodeName = MappingHelper.getStringValue( collection.getNode(), attribute.getName() );
|
||||
this.metaAttributes = HbmHelper.extractMetas( collection.getMeta(), entityMetaAttributes );
|
||||
this.cascade = defaults.getDefaultCascade();
|
||||
this.isOptimisticLockable = MappingHelper.getBooleanValue( collection.getOptimisticLock(), true );
|
||||
this.isOptimisticLockable = collection.isOptimisticLock();
|
||||
}
|
||||
|
||||
protected final MappingDefaults getDefaults() {
|
||||
|
|
|
@ -25,21 +25,21 @@ package org.hibernate.metamodel.source.hbm.state.domain;
|
|||
|
||||
import org.hibernate.metamodel.binding.CollectionElement;
|
||||
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLElementElement;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class HbmCollectionElementDomainState implements CollectionElement.DomainState {
|
||||
private final XMLElement element;
|
||||
private final XMLElementElement element;
|
||||
|
||||
HbmCollectionElementDomainState(XMLElement element) {
|
||||
HbmCollectionElementDomainState(XMLElementElement element) {
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
public final HibernateTypeDescriptor getHibernateTypeDescriptor() {
|
||||
HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||
hibernateTypeDescriptor.setTypeName( element.getType() );
|
||||
hibernateTypeDescriptor.setTypeName( element.getTypeAttribute() );
|
||||
return hibernateTypeDescriptor;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ import org.hibernate.metamodel.binding.PluralAttributeBinding;
|
|||
import org.hibernate.metamodel.domain.Attribute;
|
||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||
import org.hibernate.metamodel.source.hbm.HbmHelper;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLBag;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSynchronize;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlDelete;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlDeleteAll;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlInsert;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlUpdate;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLBagElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlDeleteAllElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlDeleteElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlInsertElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlUpdateElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSynchronizeElement;
|
||||
|
||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||
|
||||
|
@ -52,10 +52,10 @@ import org.hibernate.metamodel.source.util.MappingHelper;
|
|||
* @author Gail Badner
|
||||
*/
|
||||
public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainState implements PluralAttributeBinding.DomainState {
|
||||
private final XMLBag collection;
|
||||
private final XMLBagElement collection;
|
||||
|
||||
public HbmPluralAttributeDomainState(MappingDefaults defaults,
|
||||
XMLBag collection,
|
||||
XMLBagElement collection,
|
||||
Map<String, MetaAttribute> entityMetaAttributes,
|
||||
Attribute attribute) {
|
||||
super( defaults, attribute, entityMetaAttributes, collection );
|
||||
|
@ -68,7 +68,7 @@ public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
fetchMode = "join".equals( collection.getFetch() ) ? FetchMode.JOIN : FetchMode.SELECT;
|
||||
}
|
||||
else {
|
||||
String jfNodeValue = ( collection.getOuterJoin() == null ? "auto" : collection.getOuterJoin() );
|
||||
String jfNodeValue = ( collection.getOuterJoin().value() == null ? "auto" : collection.getOuterJoin().value() );
|
||||
if ( "auto".equals( jfNodeValue ) ) {
|
||||
fetchMode = FetchMode.DEFAULT;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
|
||||
public boolean isLazy() {
|
||||
return isExtraLazy() ||
|
||||
MappingHelper.getBooleanValue( collection.getLazy(), getDefaults().isDefaultLazy());
|
||||
MappingHelper.getBooleanValue( collection.getLazy().value(), getDefaults().isDefaultLazy());
|
||||
}
|
||||
|
||||
public boolean isExtraLazy() {
|
||||
|
@ -98,11 +98,11 @@ public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
}
|
||||
|
||||
public boolean isInverse() {
|
||||
return MappingHelper.getBooleanValue( collection.getInverse(), false );
|
||||
return collection.isInverse();
|
||||
}
|
||||
|
||||
public boolean isMutable() {
|
||||
return MappingHelper.getBooleanValue( collection.getMutable(), true );
|
||||
return collection.isMutable();
|
||||
}
|
||||
|
||||
public boolean isSubselectLoadable() {
|
||||
|
@ -157,11 +157,12 @@ public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
public int getBatchSize() {
|
||||
return MappingHelper.getIntValue( collection.getBatchSize(), 0 );
|
||||
}
|
||||
@Override
|
||||
public boolean isEmbedded() {
|
||||
return MappingHelper.getBooleanValue( collection.getEmbedXml(), true );
|
||||
return collection.isEmbedXml();
|
||||
}
|
||||
public boolean isOptimisticLocked() {
|
||||
return MappingHelper.getBooleanValue( collection.getOptimisticLock(), true );
|
||||
return collection.isOptimisticLock();
|
||||
}
|
||||
|
||||
public Class getCollectionPersisterClass() {
|
||||
|
@ -204,50 +205,50 @@ public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
}
|
||||
public java.util.Set getSynchronizedTables() {
|
||||
java.util.Set<String> synchronizedTables = new HashSet<String>();
|
||||
for ( XMLSynchronize sync : collection.getSynchronize() ) {
|
||||
for ( XMLSynchronizeElement sync : collection.getSynchronize() ) {
|
||||
synchronizedTables.add( sync.getTable() );
|
||||
}
|
||||
return synchronizedTables;
|
||||
}
|
||||
|
||||
public CustomSQL getCustomSQLInsert() {
|
||||
XMLSqlInsert sqlInsert = collection.getSqlInsert();
|
||||
XMLSqlInsertElement sqlInsert = collection.getSqlInsert();
|
||||
return sqlInsert == null ?
|
||||
null :
|
||||
HbmHelper.getCustomSql(
|
||||
collection.getSqlInsert().getContent(),
|
||||
MappingHelper.getBooleanValue( collection.getSqlInsert().getCallable(), false ),
|
||||
collection.getSqlInsert().getCheck()
|
||||
collection.getSqlInsert().getValue(),
|
||||
collection.getSqlInsert().isCallable(),
|
||||
collection.getSqlInsert().getCheck().value()
|
||||
);
|
||||
}
|
||||
public CustomSQL getCustomSQLUpdate() {
|
||||
XMLSqlUpdate sqlUpdate = collection.getSqlUpdate();
|
||||
XMLSqlUpdateElement sqlUpdate = collection.getSqlUpdate();
|
||||
return sqlUpdate == null ?
|
||||
null :
|
||||
HbmHelper.getCustomSql(
|
||||
collection.getSqlUpdate().getContent(),
|
||||
MappingHelper.getBooleanValue( collection.getSqlUpdate().getCallable(), false ),
|
||||
collection.getSqlUpdate().getCheck()
|
||||
collection.getSqlUpdate().getValue(),
|
||||
collection.getSqlUpdate().isCallable(),
|
||||
collection.getSqlUpdate().getCheck().value()
|
||||
);
|
||||
}
|
||||
public CustomSQL getCustomSQLDelete() {
|
||||
XMLSqlDelete sqlDelete = collection.getSqlDelete();
|
||||
XMLSqlDeleteElement sqlDelete = collection.getSqlDelete();
|
||||
return sqlDelete == null ?
|
||||
null :
|
||||
HbmHelper.getCustomSql(
|
||||
collection.getSqlDelete().getContent(),
|
||||
MappingHelper.getBooleanValue( collection.getSqlDelete().getCallable(), false ),
|
||||
collection.getSqlDelete().getCheck()
|
||||
collection.getSqlDelete().getValue(),
|
||||
collection.getSqlDelete().isCallable(),
|
||||
collection.getSqlDelete().getCheck().value()
|
||||
);
|
||||
}
|
||||
public CustomSQL getCustomSQLDeleteAll() {
|
||||
XMLSqlDeleteAll sqlDeleteAll = collection.getSqlDeleteAll();
|
||||
XMLSqlDeleteAllElement sqlDeleteAll = collection.getSqlDeleteAll();
|
||||
return sqlDeleteAll == null ?
|
||||
null :
|
||||
HbmHelper.getCustomSql(
|
||||
collection.getSqlDeleteAll().getContent(),
|
||||
MappingHelper.getBooleanValue( collection.getSqlDeleteAll().getCallable(), false ),
|
||||
collection.getSqlDeleteAll().getCheck()
|
||||
collection.getSqlDeleteAll().getValue(),
|
||||
collection.getSqlDeleteAll().isCallable(),
|
||||
collection.getSqlDeleteAll().getCheck().value()
|
||||
);
|
||||
}
|
||||
public String getLoaderName() {
|
||||
|
|
|
@ -30,11 +30,11 @@ import org.hibernate.mapping.PropertyGeneration;
|
|||
import org.hibernate.metamodel.binding.MappingDefaults;
|
||||
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLDiscriminator;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLProperty;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLTimestamp;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLVersion;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLTimestamp;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLVersion;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ public class HbmSimpleAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
this.isLazy = false;
|
||||
|
||||
this.propertyGeneration = PropertyGeneration.NEVER;
|
||||
this.isInsertable = MappingHelper.getBooleanValue( discriminator.getInsert(), true );
|
||||
this.isInsertable = discriminator.isInsert();
|
||||
this.isUpdateable = false;
|
||||
}
|
||||
|
||||
|
@ -83,11 +83,11 @@ public class HbmSimpleAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
// for version properties marked as being generated, make sure they are "always"
|
||||
// generated; aka, "insert" is invalid; this is dis-allowed by the DTD,
|
||||
// but just to make sure.
|
||||
this.propertyGeneration = PropertyGeneration.parse( version.getGenerated() );
|
||||
this.propertyGeneration = PropertyGeneration.parse( version.getGenerated().value() );
|
||||
if ( propertyGeneration == PropertyGeneration.INSERT ) {
|
||||
throw new MappingException( "'generated' attribute cannot be 'insert' for versioning property" );
|
||||
}
|
||||
this.isInsertable = MappingHelper.getBooleanValue( version.getInsert(), true );
|
||||
this.isInsertable = MappingHelper.getBooleanValue( version.isInsert(), true );
|
||||
this.isUpdateable = true;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class HbmSimpleAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
// for version properties marked as being generated, make sure they are "always"
|
||||
// generated; aka, "insert" is invalid; this is dis-allowed by the DTD,
|
||||
// but just to make sure.
|
||||
this.propertyGeneration = PropertyGeneration.parse( timestamp.getGenerated() );
|
||||
this.propertyGeneration = PropertyGeneration.parse( timestamp.getGenerated().value() );
|
||||
if ( propertyGeneration == PropertyGeneration.INSERT ) {
|
||||
throw new MappingException( "'generated' attribute cannot be 'insert' for versioning property" );
|
||||
}
|
||||
|
@ -113,15 +113,15 @@ public class HbmSimpleAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
public HbmSimpleAttributeDomainState(MappingDefaults defaults,
|
||||
org.hibernate.metamodel.domain.Attribute attribute,
|
||||
Map<String, MetaAttribute> entityMetaAttributes,
|
||||
XMLProperty property) {
|
||||
XMLPropertyElement property) {
|
||||
super( defaults, attribute, entityMetaAttributes, property );
|
||||
this.isLazy = MappingHelper.getBooleanValue( property.getLazy(), false );
|
||||
this.isLazy = property.isLazy();
|
||||
;
|
||||
this.propertyGeneration = PropertyGeneration.parse( property.getGenerated() );
|
||||
|
||||
if ( propertyGeneration == PropertyGeneration.ALWAYS || propertyGeneration == PropertyGeneration.INSERT ) {
|
||||
// generated properties can *never* be insertable.
|
||||
if ( property.getInsert() != null && Boolean.parseBoolean( property.getInsert() ) ) {
|
||||
if (property.isInsert() != null && property.isInsert()) {
|
||||
// the user specifically supplied insert="true", which constitutes an illegal combo
|
||||
throw new MappingException(
|
||||
"cannot specify both insert=\"true\" and generated=\"" + propertyGeneration.getName() +
|
||||
|
@ -132,10 +132,10 @@ public class HbmSimpleAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
isInsertable = false;
|
||||
}
|
||||
else {
|
||||
isInsertable = MappingHelper.getBooleanValue( property.getInsert(), true );
|
||||
isInsertable = MappingHelper.getBooleanValue( property.isInsert(), true );
|
||||
}
|
||||
if ( propertyGeneration == PropertyGeneration.ALWAYS ) {
|
||||
if ( property.getUpdate() != null && Boolean.parseBoolean( property.getUpdate() ) ) {
|
||||
if (property.isUpdate() != null && property.isUpdate()) {
|
||||
// the user specifically supplied update="true",
|
||||
// which constitutes an illegal combo
|
||||
throw new MappingException(
|
||||
|
@ -147,10 +147,11 @@ public class HbmSimpleAttributeDomainState extends AbstractHbmAttributeDomainSta
|
|||
isUpdateable = false;
|
||||
}
|
||||
else {
|
||||
isUpdateable = MappingHelper.getBooleanValue( property.getUpdate(), true );
|
||||
isUpdateable = MappingHelper.getBooleanValue( property.isUpdate(), true );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEmbedded() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ import org.hibernate.cfg.NamingStrategy;
|
|||
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
||||
import org.hibernate.metamodel.relational.Size;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLColumnElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLDiscriminator;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLProperty;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLTimestamp;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLVersion;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLTimestamp;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLVersion;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||
|
||||
// TODO: remove duplication after Id, Discriminator, Version, Timestamp, and Property extend a common interface.
|
||||
|
@ -63,8 +63,8 @@ public class HbmColumnRelationalState implements SimpleAttributeBinding.ColumnRe
|
|||
this.container = container;
|
||||
this.explicitColumnName = columnElement.getName();
|
||||
this.size = createSize( columnElement.getLength(), columnElement.getScale(), columnElement.getPrecision() );
|
||||
this.isNullable = createNullable( columnElement.getNotNull() );
|
||||
this.isUnique = createUnique( columnElement.getUnique() );
|
||||
this.isNullable = !MappingHelper.getBooleanValue( columnElement.isNotNull(), true );
|
||||
this.isUnique = MappingHelper.getBooleanValue( columnElement.isUnique(), true );
|
||||
this.checkCondition = columnElement.getCheck();
|
||||
this.defaultColumnValue = columnElement.getDefault();
|
||||
this.sqlType = columnElement.getSqlType();
|
||||
|
@ -80,13 +80,13 @@ public class HbmColumnRelationalState implements SimpleAttributeBinding.ColumnRe
|
|||
this.indexes.addAll( container.getPropertyIndexes() );
|
||||
}
|
||||
|
||||
HbmColumnRelationalState(XMLProperty property,
|
||||
HbmColumnRelationalState(XMLPropertyElement property,
|
||||
HbmSimpleValueRelationalStateContainer container) {
|
||||
this.container = container;
|
||||
this.explicitColumnName = property.getName();
|
||||
this.size = createSize( property.getLength(), property.getScale(), property.getPrecision() );
|
||||
this.isNullable = createNullable( property.getNotNull() );
|
||||
this.isUnique = createUnique( property.getUnique() );
|
||||
this.isUnique = MappingHelper.getBooleanValue( property.isUnique(), true );
|
||||
this.isNullable = !MappingHelper.getBooleanValue( property.isNotNull(), true );
|
||||
this.checkCondition = null;
|
||||
this.defaultColumnValue = null;
|
||||
this.sqlType = null;
|
||||
|
@ -101,7 +101,7 @@ public class HbmColumnRelationalState implements SimpleAttributeBinding.ColumnRe
|
|||
|
||||
HbmColumnRelationalState(XMLId id,
|
||||
HbmSimpleValueRelationalStateContainer container) {
|
||||
if ( id.getColumnElement() != null && ! id.getColumnElement().isEmpty() ) {
|
||||
if ( id.getColumn() != null && ! id.getColumn().isEmpty() ) {
|
||||
throw new IllegalArgumentException( "This method should not be called with non-empty id.getColumnElement()" );
|
||||
}
|
||||
this.container = container;
|
||||
|
@ -121,7 +121,7 @@ public class HbmColumnRelationalState implements SimpleAttributeBinding.ColumnRe
|
|||
|
||||
HbmColumnRelationalState(XMLDiscriminator discriminator,
|
||||
HbmSimpleValueRelationalStateContainer container) {
|
||||
if ( discriminator.getColumnElement() != null ) {
|
||||
if ( discriminator.getColumn() != null ) {
|
||||
throw new IllegalArgumentException( "This method should not be called with null discriminator.getColumnElement()" );
|
||||
}
|
||||
this.container = container;
|
||||
|
@ -142,8 +142,8 @@ public class HbmColumnRelationalState implements SimpleAttributeBinding.ColumnRe
|
|||
HbmColumnRelationalState(XMLVersion version,
|
||||
HbmSimpleValueRelationalStateContainer container) {
|
||||
this.container = container;
|
||||
this.explicitColumnName = version.getColumn();
|
||||
if ( version.getColumnElement() != null && ! version.getColumnElement().isEmpty() ) {
|
||||
this.explicitColumnName = version.getColumnAttribute();
|
||||
if ( version.getColumn() != null && ! version.getColumn().isEmpty() ) {
|
||||
throw new IllegalArgumentException( "This method should not be called with non-empty version.getColumnElement()" );
|
||||
}
|
||||
// TODO: should set default
|
||||
|
@ -206,18 +206,10 @@ public class HbmColumnRelationalState implements SimpleAttributeBinding.ColumnRe
|
|||
return isNullable;
|
||||
}
|
||||
|
||||
private static boolean createNullable(String notNullString ) {
|
||||
return ! MappingHelper.getBooleanValue( notNullString, false );
|
||||
}
|
||||
|
||||
public boolean isUnique() {
|
||||
return isUnique;
|
||||
}
|
||||
|
||||
private boolean createUnique(String uniqueString) {
|
||||
return ! MappingHelper.getBooleanValue( uniqueString, false );
|
||||
}
|
||||
|
||||
public String getCheckCondition() {
|
||||
return checkCondition;
|
||||
}
|
||||
|
|
|
@ -33,11 +33,11 @@ import org.hibernate.cfg.NamingStrategy;
|
|||
import org.hibernate.metamodel.binding.MappingDefaults;
|
||||
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLColumnElement;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLDiscriminator;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLProperty;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLTimestamp;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLVersion;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLTimestamp;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLVersion;
|
||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
|
@ -57,7 +57,7 @@ public class HbmSimpleValueRelationalStateContainer implements SimpleAttributeBi
|
|||
public HbmSimpleValueRelationalStateContainer(MappingDefaults defaults,
|
||||
boolean autoColumnCreation,
|
||||
XMLId id) {
|
||||
this( defaults, id.getColumnElement() );
|
||||
this( defaults, id.getColumn() );
|
||||
if ( singleValueStates.isEmpty() ) {
|
||||
if ( id.getColumn() == null && ! autoColumnCreation ) {
|
||||
throw new MappingException( "No columns to map and auto column creation is disabled." );
|
||||
|
@ -72,7 +72,7 @@ public class HbmSimpleValueRelationalStateContainer implements SimpleAttributeBi
|
|||
public HbmSimpleValueRelationalStateContainer(MappingDefaults defaults,
|
||||
boolean autoColumnCreation,
|
||||
XMLDiscriminator discriminator) {
|
||||
this( defaults, discriminator.getFormulaElement(), discriminator.getColumnElement() );
|
||||
this( defaults, discriminator.getFormula(), discriminator.getColumn() );
|
||||
if ( singleValueStates.isEmpty() ) {
|
||||
if ( discriminator.getColumn() == null && discriminator.getFormula() == null && ! autoColumnCreation ) {
|
||||
throw new MappingException( "No column or formula to map and auto column creation is disabled." );
|
||||
|
@ -87,7 +87,7 @@ public class HbmSimpleValueRelationalStateContainer implements SimpleAttributeBi
|
|||
public HbmSimpleValueRelationalStateContainer(MappingDefaults defaults,
|
||||
boolean autoColumnCreation,
|
||||
XMLVersion version) {
|
||||
this( defaults, version.getColumnElement() );
|
||||
this( defaults, version.getColumn() );
|
||||
if ( singleValueStates.isEmpty() ) {
|
||||
if ( version.getColumn() == null && ! autoColumnCreation ) {
|
||||
throw new MappingException( "No column or formula to map and auto column creation is disabled." );
|
||||
|
@ -116,8 +116,8 @@ public class HbmSimpleValueRelationalStateContainer implements SimpleAttributeBi
|
|||
|
||||
public HbmSimpleValueRelationalStateContainer(MappingDefaults defaults,
|
||||
boolean autoColumnCreation,
|
||||
XMLProperty property) {
|
||||
this( defaults, property.getColumnElementOrFormulaElement() );
|
||||
XMLPropertyElement property) {
|
||||
this( defaults, property.getColumnOrFormula() );
|
||||
if ( singleValueStates.isEmpty() ) {
|
||||
if ( property.getColumn() == null && property.getFormula() == null && ! autoColumnCreation ) {
|
||||
throw new MappingException( "No column or formula to map and auto column creation is disabled." );
|
||||
|
|
|
@ -80,6 +80,10 @@ public class MappingHelper {
|
|||
return value == null ? defaultValue : Boolean.valueOf( value );
|
||||
}
|
||||
|
||||
public static boolean getBooleanValue(Boolean value, boolean defaultValue) {
|
||||
return value == null ? defaultValue : value;
|
||||
}
|
||||
|
||||
public static Class extractClassAttributeValue(Element element, String attributeName)
|
||||
throws ClassNotFoundException {
|
||||
String attributeValue = ( element == null ? null : element.attributeValue( attributeName ) );
|
||||
|
|
|
@ -1,90 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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
|
||||
-->
|
||||
|
||||
<!--
|
||||
Hibernate file-based configuration document.
|
||||
<!-- Hibernate file-based configuration document.
|
||||
|
||||
<!DOCTYPE hibernate-configuration PUBLIC
|
||||
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
|
||||
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
|
||||
|
||||
An instance of this document contains property settings and references
|
||||
to mapping files for a number of SessionFactory instances to be listed
|
||||
in JNDI.
|
||||
An instance of this document contains property settings and references
|
||||
to mapping files for a number of SessionFactory instances to be listed
|
||||
in JNDI.
|
||||
|
||||
-->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns="http://www.hibernate.org/xsd/hibernate-configuration"
|
||||
targetNamespace="http://www.hibernate.org/xsd/hibernate-configuration"
|
||||
xmlns:config="http://www.hibernate.org/xsd/hibernate-configuration" version="4.0">
|
||||
version="4.0">
|
||||
|
||||
<xs:element name="hibernate-configuration">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="config:session-factory"/>
|
||||
<xs:element minOccurs="0" ref="config:security"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="property">
|
||||
<xs:complexType mixed="true">
|
||||
<xs:attributeGroup ref="config:attlist.property"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.property">
|
||||
<xs:attribute name="name" use="required"/>
|
||||
</xs:attributeGroup>
|
||||
<xs:element name="mapping">
|
||||
<xs:element name="session-factory">
|
||||
<xs:complexType>
|
||||
<xs:attributeGroup ref="config:attlist.mapping"/>
|
||||
<xs:sequence>
|
||||
<xs:element name="property" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType mixed="true">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute name="name" use="required" type="xs:string"/> <!-- reference to a mapping file -->
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<!-- reference to a mapping file -->
|
||||
<xs:attributeGroup name="attlist.mapping">
|
||||
<xs:attribute name="resource"/>
|
||||
<xs:attribute name="file"/>
|
||||
<xs:attribute name="jar"/>
|
||||
<xs:attribute name="package"/>
|
||||
<xs:attribute name="class"/>
|
||||
</xs:attributeGroup>
|
||||
<xs:element name="mapping" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="class" type="xs:string"/>
|
||||
<xs:attribute name="file" type="xs:string"/>
|
||||
<xs:attribute name="jar" type="xs:string"/>
|
||||
<xs:attribute name="package" type="xs:string"/>
|
||||
<xs:attribute name="resource" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="class-cache">
|
||||
<xs:complexType>
|
||||
<xs:attributeGroup ref="config:attlist.class-cache"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.class-cache">
|
||||
<xs:attribute name="class" use="required"/>
|
||||
<xs:attribute name="region"/>
|
||||
<xs:attribute name="usage" use="required">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:token">
|
||||
<xs:enumeration value="read-only"/>
|
||||
<xs:enumeration value="read-write"/>
|
||||
<xs:enumeration value="nonstrict-read-write"/>
|
||||
<xs:enumeration value="transactional"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="class" use="required" type="xs:string"/>
|
||||
<xs:attribute name="include" default="all">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:token">
|
||||
|
@ -93,163 +48,100 @@
|
|||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
</xs:attributeGroup>
|
||||
<xs:element name="collection-cache">
|
||||
<xs:complexType>
|
||||
<xs:attributeGroup ref="config:attlist.collection-cache"/>
|
||||
<xs:attribute name="region" type="xs:string"/>
|
||||
<xs:attribute name="usage" use="required" type="usage-attribute"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.collection-cache">
|
||||
<xs:attribute name="collection" use="required"/>
|
||||
<xs:attribute name="region"/>
|
||||
<xs:attribute name="usage" use="required">
|
||||
<xs:simpleType>
|
||||
<xs:element name="collection-cache">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="collection" use="required" type="xs:string"/>
|
||||
<xs:attribute name="region" type="xs:string"/>
|
||||
<xs:attribute name="usage" use="required" type="usage-attribute"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
<xs:element name="event" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="listener" minOccurs="0" maxOccurs="unbounded" type="listener-element"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="type" use="required" type="type-attribute"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="listener" minOccurs="0" maxOccurs="unbounded" type="listener-element"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name" type="xs:string"/> <!-- the JNDI name -->
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="security" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="grant" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="actions" use="required" type="xs:string"/>
|
||||
<xs:attribute name="entity-name" use="required" type="xs:string"/>
|
||||
<xs:attribute name="role" use="required" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="context" use="required" type="xs:string"/> <!--the JACC contextID-->
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:complexType name="listener-element">
|
||||
<xs:attribute name="class" use="required" type="xs:string"/>
|
||||
<xs:attribute name="type" type="type-attribute"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:simpleType name="type-attribute">
|
||||
<xs:restriction base="xs:token">
|
||||
<xs:enumeration value="auto-flush"/>
|
||||
<xs:enumeration value="create"/>
|
||||
<xs:enumeration value="create-onflush"/>
|
||||
<xs:enumeration value="delete"/>
|
||||
<xs:enumeration value="dirty-check"/>
|
||||
<xs:enumeration value="evict"/>
|
||||
<xs:enumeration value="flush"/>
|
||||
<xs:enumeration value="flush-entity"/>
|
||||
<xs:enumeration value="load"/>
|
||||
<xs:enumeration value="load-collection"/>
|
||||
<xs:enumeration value="lock"/>
|
||||
<xs:enumeration value="merge"/>
|
||||
<xs:enumeration value="post-collection-recreate"/>
|
||||
<xs:enumeration value="post-collection-remove"/>
|
||||
<xs:enumeration value="post-collection-update"/>
|
||||
<xs:enumeration value="post-commit-delete"/>
|
||||
<xs:enumeration value="post-commit-insert"/>
|
||||
<xs:enumeration value="post-commit-update"/>
|
||||
<xs:enumeration value="post-delete"/>
|
||||
<xs:enumeration value="post-insert"/>
|
||||
<xs:enumeration value="post-load"/>
|
||||
<xs:enumeration value="post-update"/>
|
||||
<xs:enumeration value="pre-collection-recreate"/>
|
||||
<xs:enumeration value="pre-collection-remove"/>
|
||||
<xs:enumeration value="pre-collection-update"/>
|
||||
<xs:enumeration value="pre-delete"/>
|
||||
<xs:enumeration value="pre-insert"/>
|
||||
<xs:enumeration value="pre-load"/>
|
||||
<xs:enumeration value="pre-update"/>
|
||||
<xs:enumeration value="refresh"/>
|
||||
<xs:enumeration value="replicate"/>
|
||||
<xs:enumeration value="save"/>
|
||||
<xs:enumeration value="save-update"/>
|
||||
<xs:enumeration value="update"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="usage-attribute">
|
||||
<xs:restriction base="xs:token">
|
||||
<xs:enumeration value="nonstrict-read-write"/>
|
||||
<xs:enumeration value="read-only"/>
|
||||
<xs:enumeration value="read-write"/>
|
||||
<xs:enumeration value="nonstrict-read-write"/>
|
||||
<xs:enumeration value="transactional"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
</xs:attributeGroup>
|
||||
<xs:element name="event">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" ref="config:listener"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="config:attlist.event"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.event">
|
||||
<xs:attribute name="type" use="required">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:token">
|
||||
<xs:enumeration value="auto-flush"/>
|
||||
<xs:enumeration value="merge"/>
|
||||
<xs:enumeration value="create"/>
|
||||
<xs:enumeration value="create-onflush"/>
|
||||
<xs:enumeration value="delete"/>
|
||||
<xs:enumeration value="dirty-check"/>
|
||||
<xs:enumeration value="evict"/>
|
||||
<xs:enumeration value="flush"/>
|
||||
<xs:enumeration value="flush-entity"/>
|
||||
<xs:enumeration value="load"/>
|
||||
<xs:enumeration value="load-collection"/>
|
||||
<xs:enumeration value="lock"/>
|
||||
<xs:enumeration value="refresh"/>
|
||||
<xs:enumeration value="replicate"/>
|
||||
<xs:enumeration value="save-update"/>
|
||||
<xs:enumeration value="save"/>
|
||||
<xs:enumeration value="update"/>
|
||||
<xs:enumeration value="pre-load"/>
|
||||
<xs:enumeration value="pre-update"/>
|
||||
<xs:enumeration value="pre-insert"/>
|
||||
<xs:enumeration value="pre-delete"/>
|
||||
<xs:enumeration value="pre-collection-recreate"/>
|
||||
<xs:enumeration value="pre-collection-remove"/>
|
||||
<xs:enumeration value="pre-collection-update"/>
|
||||
<xs:enumeration value="post-load"/>
|
||||
<xs:enumeration value="post-update"/>
|
||||
<xs:enumeration value="post-insert"/>
|
||||
<xs:enumeration value="post-delete"/>
|
||||
<xs:enumeration value="post-collection-recreate"/>
|
||||
<xs:enumeration value="post-collection-remove"/>
|
||||
<xs:enumeration value="post-collection-update"/>
|
||||
<xs:enumeration value="post-commit-update"/>
|
||||
<xs:enumeration value="post-commit-insert"/>
|
||||
<xs:enumeration value="post-commit-delete"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
</xs:attributeGroup>
|
||||
<xs:element name="listener">
|
||||
<xs:complexType>
|
||||
<xs:attributeGroup ref="config:attlist.listener"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.listener">
|
||||
<xs:attribute name="type">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:token">
|
||||
<xs:enumeration value="auto-flush"/>
|
||||
<xs:enumeration value="merge"/>
|
||||
<xs:enumeration value="create"/>
|
||||
<xs:enumeration value="create-onflush"/>
|
||||
<xs:enumeration value="delete"/>
|
||||
<xs:enumeration value="dirty-check"/>
|
||||
<xs:enumeration value="evict"/>
|
||||
<xs:enumeration value="flush"/>
|
||||
<xs:enumeration value="flush-entity"/>
|
||||
<xs:enumeration value="load"/>
|
||||
<xs:enumeration value="load-collection"/>
|
||||
<xs:enumeration value="lock"/>
|
||||
<xs:enumeration value="refresh"/>
|
||||
<xs:enumeration value="replicate"/>
|
||||
<xs:enumeration value="save-update"/>
|
||||
<xs:enumeration value="save"/>
|
||||
<xs:enumeration value="update"/>
|
||||
<xs:enumeration value="pre-load"/>
|
||||
<xs:enumeration value="pre-update"/>
|
||||
<xs:enumeration value="pre-insert"/>
|
||||
<xs:enumeration value="pre-delete"/>
|
||||
<xs:enumeration value="pre-collection-recreate"/>
|
||||
<xs:enumeration value="pre-collection-remove"/>
|
||||
<xs:enumeration value="pre-collection-update"/>
|
||||
<xs:enumeration value="post-load"/>
|
||||
<xs:enumeration value="post-update"/>
|
||||
<xs:enumeration value="post-insert"/>
|
||||
<xs:enumeration value="post-delete"/>
|
||||
<xs:enumeration value="post-collection-recreate"/>
|
||||
<xs:enumeration value="post-collection-remove"/>
|
||||
<xs:enumeration value="post-collection-update"/>
|
||||
<xs:enumeration value="post-commit-update"/>
|
||||
<xs:enumeration value="post-commit-insert"/>
|
||||
<xs:enumeration value="post-commit-delete"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="class" use="required"/>
|
||||
</xs:attributeGroup>
|
||||
<xs:element name="session-factory">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" ref="config:property"/>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" ref="config:mapping"/>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="config:class-cache"/>
|
||||
<xs:element ref="config:collection-cache"/>
|
||||
</xs:choice>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" ref="config:event"/>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" ref="config:listener"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="config:attlist.session-factory"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.session-factory">
|
||||
<xs:attribute name="name"/>
|
||||
</xs:attributeGroup>
|
||||
<!-- the JNDI name -->
|
||||
<xs:element name="security">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" ref="config:grant"/>
|
||||
</xs:sequence>
|
||||
<xs:attributeGroup ref="config:attlist.security"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.security">
|
||||
<xs:attribute name="context" use="required"/>
|
||||
</xs:attributeGroup>
|
||||
<!-- the JACC contextID -->
|
||||
<xs:element name="grant">
|
||||
<xs:complexType>
|
||||
<xs:attributeGroup ref="config:attlist.grant"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.grant">
|
||||
<xs:attribute name="role" use="required"/>
|
||||
<xs:attribute name="entity-name" use="required"/>
|
||||
<xs:attribute name="actions" use="required"/>
|
||||
</xs:attributeGroup>
|
||||
|
||||
</xs:schema>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,6 +14,90 @@
|
|||
<jxb:anonymousTypeName prefix="XML"/>
|
||||
</jxb:nameXmlTransform>
|
||||
</jxb:schemaBindings>
|
||||
<jxb:bindings node="//xs:element[@name='class']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:element[@name='discriminator']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:element[@name='discriminator']//xs:attribute[@name='formula']">
|
||||
<jxb:property name="formulaAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:element[@name='id']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:element[@name='id']//xs:attribute[@name='type']">
|
||||
<jxb:property name="typeAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:element[@name='version']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='array-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='bag-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='element-element']//xs:attribute[@name='type']">
|
||||
<jxb:property name="typeAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='idbag-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='idbag-element']//xs:element[@name='collection-id']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='index-element']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='join-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='joined-subclass-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='key-element']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='key-many-to-one-element']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='key-property-element']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='key-property-element']//xs:attribute[@name='type']">
|
||||
<jxb:property name="typeAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='list-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='list-index-element']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='map-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='map-element']//xs:element[@name='map-key']//xs:attribute[@name='type']">
|
||||
<jxb:property name="typeAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='map-element']//xs:element[@name='index-many-to-many']//xs:attribute[@name='column']">
|
||||
<jxb:property name="columnAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='one-to-one-element']//xs:attribute[@name='formula']">
|
||||
<jxb:property name="formulaAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='primitive-array-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='property-element']//xs:attribute[@name='type']">
|
||||
<jxb:property name="typeAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='set-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
<jxb:bindings node="//xs:complexType[@name='union-subclass-element']//xs:attribute[@name='subselect']">
|
||||
<jxb:property name="subselectAttribute"/>
|
||||
</jxb:bindings>
|
||||
</jxb:bindings>
|
||||
|
||||
</jxb:bindings>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<hibernate-mapping package="org.hibernate.metamodel.binding" xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
|
||||
<hhh:hibernate-mapping package="org.hibernate.metamodel.binding" xmlns:hhh="http://www.hibernate.org/xsd/hibernate-mapping"
|
||||
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping hibernate-mapping-4.0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
|
@ -11,4 +11,4 @@
|
|||
<property name="name"/>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
</hhh:hibernate-mapping>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<hibernate-mapping package="org.hibernate.metamodel.binding" xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
|
||||
<hhh:hibernate-mapping package="org.hibernate.metamodel.binding" xmlns:hhh="http://www.hibernate.org/xsd/hibernate-mapping"
|
||||
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping hibernate-mapping-4.0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
|
@ -35,4 +35,4 @@
|
|||
<property name="name"/>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
</hhh:hibernate-mapping>
|
||||
|
|
Loading…
Reference in New Issue