Created
May 16, 2011 16:56
-
-
Save gbadner/974835 to your computer and use it in GitHub Desktop.
Entity/Attribute Binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HHH-6227 will provide a way to update Entity/Attribute objects in EntityBinding/AttributeBinding objects | |
EntityBinding entityBinding = | |
new EntityBinding( name ) | |
.initialize( new HbmEntityBindingState( getHibernateMappingBinder(), ... ) | |
.initialize( new HbmEntityRelationalState( getHibernateMappingBinder(), ... ); | |
entityBinding.setEntity( new Entity( name ) ) can be called immediately or later | |
SimpleAttributeBinding attributeBinding = | |
entityBinding.makeSimpleAttributeBinding( name ) | |
.initialize( new HbmSimpleAttributeBindingState( getHibernateMappingBinder(), ... ) | |
.initialize( new HbmSimpleAttributeRelationalState( getHibernateMappingBinder(), ... ) | |
attributeBinding.setAttribute( entity.getOrCreateSingularAttribute( name ) ) can be called immediately or later | |
// CompositeAttributeBinding groups singular attributes for: | |
// creating primary/surrogate keys, or grouped to be used for element collections. | |
// | |
// CompositeAttributeBinding does not have an associated Embeddable class | |
// CompositeAttributeBinding has no domain representation | |
// Attributes contained by CompositeAttributeBinding are defined directly on the EntityBinding | |
// (not completely sure this will always work) | |
CompositeAttributeBinding compositeAttributeBinding = entityBinding.makeCompositeAttributeBinding(); | |
for ( Object attributeInfo : attributeInfoList ) { | |
if ( attributeInfo is simple prop ) { | |
compositeAttributeBinding.makeSimpleAttributeBindingState( ) | |
.initialize( new HbmSimpleAttributeBindingState( getHibernateMappingBinder(), ... ) | |
.initialize( new HbmSimpleAttributeRelationalState( getHibernateMappingBinder(), ... ) | |
} | |
if ( keyPropertyOrKeyManyToOne is <key-many-to-one> ) { | |
.... | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment