Skip to content

Commit

Permalink
HHH-17504 - Ongoing JPA 32 work
Browse files Browse the repository at this point in the history
HHH-17350 - Work on hibernate-models, XSD and JAXB
HHH-16114 - Improve boot metamodel binding
HHH-15996 - Develop an abstraction for Annotation in annotation processing
HHH-16012 - Develop an abstraction for domain model Class refs
HHH-15997 - Support for dynamic models in orm.xml
HHH-15698 - Support for entity-name in mapping.xsd
  • Loading branch information
sebersole committed Dec 4, 2023
1 parent f334b86 commit 75b8b58
Show file tree
Hide file tree
Showing 11 changed files with 447 additions and 584 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import org.hibernate.boot.model.convert.internal.ClassBasedConverterDescriptor;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.models.AnnotationPlacementException;
import org.hibernate.boot.models.bind.internal.binders.BasicValueBinder;
import org.hibernate.boot.models.bind.internal.binders.ColumnBinder;
import org.hibernate.boot.models.bind.spi.BindingContext;
import org.hibernate.boot.models.bind.spi.BindingOptions;
import org.hibernate.boot.models.bind.spi.BindingState;
Expand Down Expand Up @@ -93,41 +91,38 @@ private BasicValue createBasicValue(Table primaryTable) {
final BasicValue basicValue = new BasicValue( bindingState.getMetadataBuildingContext() );

final MemberDetails member = attributeMetadata.getMember();
bindImplicitJavaType( member, property, basicValue );
BasicValueHelper.bindImplicitJavaType( member, basicValue, bindingOptions, bindingState, bindingContext );
bindMutability( member, property, basicValue );
bindOptimisticLocking( member, property, basicValue );
bindConversion( member, property, basicValue );

processColumn( member, property, basicValue, primaryTable, Column.class );

BasicValueBinder.bindJavaType( member, property, basicValue, bindingOptions, bindingState, bindingContext );
BasicValueBinder.bindJdbcType( member, property, basicValue, bindingOptions, bindingState, bindingContext );
BasicValueBinder.bindLob( member, property, basicValue, bindingOptions, bindingState, bindingContext );
BasicValueBinder.bindNationalized(
BasicValueHelper.bindJavaType( member, basicValue, bindingOptions, bindingState, bindingContext );
BasicValueHelper.bindJdbcType( member, basicValue, bindingOptions, bindingState, bindingContext );
BasicValueHelper.bindLob( member, basicValue, bindingOptions, bindingState, bindingContext );
BasicValueHelper.bindNationalized(
member,
property,
basicValue,
bindingOptions,
bindingState,
bindingContext
);
BasicValueBinder.bindEnumerated(
BasicValueHelper.bindEnumerated(
member,
property,
basicValue,
bindingOptions,
bindingState,
bindingContext
);
BasicValueBinder.bindTemporalPrecision(
BasicValueHelper.bindTemporalPrecision(
member,
property,
basicValue,
bindingOptions,
bindingState,
bindingContext
);
BasicValueBinder.bindTimeZoneStorage(
BasicValueHelper.bindTimeZoneStorage(
member,
property,
basicValue,
Expand Down Expand Up @@ -156,13 +151,6 @@ public Property getBinding() {
return getProperty();
}

public static void bindImplicitJavaType(
MemberDetails member,
@SuppressWarnings("unused") Property property,
BasicValue basicValue) {
basicValue.setImplicitJavaTypeAccess( (typeConfiguration) -> member.getType().toJavaClass() );
}

private void bindMutability(MemberDetails member, Property property, BasicValue basicValue) {
final var mutabilityAnn = member.getAnnotationUsage( Mutability.class );
final var immutableAnn = member.getAnnotationUsage( Immutable.class );
Expand Down Expand Up @@ -236,9 +224,18 @@ public <A extends Annotation> void processColumn(
BasicValue basicValue,
Table primaryTable,
Class<A> annotation) {
BasicValueHelper.bindColumn(
member,
property::getName,
basicValue,
primaryTable,
bindingOptions,
bindingState,
bindingContext
);
// todo : implicit column
final var columnAnn = member.getAnnotationUsage( annotation );
final var column = ColumnBinder.bindColumn( columnAnn, property::getName );
final var column = ColumnHelper.bindColumn( columnAnn, property::getName );

var tableName = BindingHelper.getValue( columnAnn, "table", "" );
if ( "".equals( tableName ) || tableName == null ) {
Expand Down

0 comments on commit 75b8b58

Please sign in to comment.