public static void process(AttributePath attributePath, StringBuilder sb) { if ( attributePath.getParent() != null ) { process( attributePath.getParent(), sb ); if ( !"".equals( attributePath.getParent().getProperty() ) ) { sb.append( "_" ); } } String property = attributePath.getProperty(); property = property.replace( "<", "" ); property = property.replace( ">", "" ); sb.append( property ); } }
private String componentPath(AttributePath attributePath) { AttributePath parentAttributePath = attributePath; StringBuilder builder = new StringBuilder( parentAttributePath.getProperty() ); while ( !attributePath.getParent().isCollectionElement() ) { attributePath = attributePath.getParent(); builder.insert( 0, "." ); builder.insert( 0, attributePath.getProperty() ); } String componentPath = builder.toString(); return componentPath; } }
public static void process(AttributePath attributePath, StringBuilder sb) { if ( attributePath.getParent() != null ) { process( attributePath.getParent(), sb ); if ( !"".equals( attributePath.getParent().getProperty() ) ) { sb.append( "_" ); } } String property = attributePath.getProperty(); property = property.replace( "<", "" ); property = property.replace( ">", "" ); sb.append( property ); } }
AttributePath parent = path.getParent(); String translatedParent = transformAttributePath(parent);
/** * Generates a name for a table column. */ @Override public Identifier determineBasicColumnName(ImplicitBasicColumnNameSource source) { AttributePath attributePath = source.getAttributePath(); String propertyName = getPropertyName(attributePath); String parentPropertyName = getPropertyName(attributePath.getParent()); Ejb3Column column = getEjb3Column(source); // generate a name for an embedded column if (isEmbedded(column)) { String fluentNamePrefix = getFluentNamePrefix(column, parentPropertyName); boolean hasEmbeddedPrefix = !InternalUtils.StringUtils.isEmpty(fluentNamePrefix); String prefix = hasEmbeddedPrefix ? fluentNamePrefix : parentPropertyName; boolean dontTouchPrefix = hasEmbeddedPrefix; return toIdentifier( strategy.embeddedPropertyToColumnName(prefix, propertyName, dontTouchPrefix), source); } // It is a strange behaviour for collection associations. // For an example for a "roles" association Hibernate uses "roles.element". if (!InternalUtils.StringUtils.isEmpty(parentPropertyName) && propertyName.equals("element")) { return toIdentifier(propertyName, source); } // Hibernate calls this method the first time for @Embedded column, but doesn't use a result return toIdentifier(strategy.propertyToColumnName(propertyName), source); }