private String prepareCompositeIndexName ( String indexedColumns , final EntityType entityType , EntityMetadata metadata ) { StringTokenizer tokenizer = new StringTokenizer ( indexedColumns , "," ) ; StringBuilder builder = new StringBuilder ( ) ; while ( tokenizer . hasMoreTokens ( ) ) { String fieldName = ( String ) tokenizer . nextElement ( ) ; StringTokenizer stringTokenizer = new StringTokenizer ( fieldName , "." ) ; // if need to select embedded columns if ( stringTokenizer . countTokens ( ) > 1 ) { fieldName = stringTokenizer . nextToken ( ) ; String embeddedFieldName = stringTokenizer . nextToken ( ) ; Attribute embeddable = entityType . getAttribute ( fieldName ) ; EmbeddableType embeddedEntity = ( EmbeddableType ) kunderaMetadata . getApplicationMetadata ( ) . getMetaModelBuilder ( metadata . getPersistenceUnit ( ) ) . getEmbeddables ( ) . get ( ( ( AbstractAttribute ) embeddable ) . getBindableJavaType ( ) ) ; Attribute embeddedAttribute = embeddedEntity . getAttribute ( embeddedFieldName ) ; builder . append ( ( ( AbstractAttribute ) embeddedAttribute ) . getJPAColumnName ( ) ) ; } else { builder . append ( ( ( AbstractAttribute ) entityType . getAttribute ( fieldName ) ) . getJPAColumnName ( ) ) ; } builder . append ( "," ) ; } // scan embeddable as well for builder . deleteCharAt ( builder . length ( ) - 1 ) ; return builder . toString ( ) ; }
prepare composite index .