/** * Generates a root alias by truncating the "root name" defined by * the incoming decription and removing/modifying any non-valid * alias characters. * * @param description The root name from which to generate a root alias. * * @return The generated root alias. */ private static String generateAliasRoot(String description) { String result = truncate( unqualifyEntityName( description ), ALIAS_TRUNCATE_LENGTH ) .toLowerCase( Locale.ROOT ) .replace( '/', '_' ) // entityNames may now include slashes for the representations .replace( '$', '_' ); //classname may be an inner class result = cleanAlias( result ); if ( Character.isDigit( result.charAt( result.length() - 1 ) ) ) { return result + "x"; //ick! } else { return result; } }
private String createTableAlias(EntityPersister entityPersister) { return createTableAlias( StringHelper.unqualifyEntityName( entityPersister.getEntityName() ) ); }
@Test @TestForIssue(jiraKey = "HHH-6790") public void testSequencePerEntity() { // Checking first entity. EntityPersister persister = sessionFactory().getEntityPersister( DedicatedSequenceEntity1.class.getName() ); IdentifierGenerator generator = persister.getIdentifierGenerator(); assertTrue( SequenceStyleGenerator.class.isInstance( generator ) ); SequenceStyleGenerator seqGenerator = (SequenceStyleGenerator) generator; assertEquals( StringHelper.unqualifyEntityName( DedicatedSequenceEntity1.class.getName() ) + DedicatedSequenceEntity1.SEQUENCE_SUFFIX, seqGenerator.getDatabaseStructure().getName() ); // Checking second entity. persister = sessionFactory().getEntityPersister( DedicatedSequenceEntity2.class.getName() ); generator = persister.getIdentifierGenerator(); assertTrue( SequenceStyleGenerator.class.isInstance( generator ) ); seqGenerator = (SequenceStyleGenerator) generator; assertEquals( DedicatedSequenceEntity2.ENTITY_NAME + DedicatedSequenceEntity1.SEQUENCE_SUFFIX, seqGenerator.getDatabaseStructure().getName() ); } }
/** * Generates a root alias by truncating the "root name" defined by * the incoming decription and removing/modifying any non-valid * alias characters. * * @param description The root name from which to generate a root alias. * @return The generated root alias. */ private static String generateAliasRoot(String description) { String result = truncate( unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH ) .toLowerCase() .replace( '/', '_' ) // entityNames may now include slashes for the representations .replace( '$', '_' ); //classname may be an inner class result = cleanAlias( result ); if ( Character.isDigit( result.charAt(result.length()-1) ) ) { return result + "x"; //ick! } else { return result; } }
/** * Generates a root alias by truncating the "root name" defined by * the incoming decription and removing/modifying any non-valid * alias characters. * * @param description The root name from which to generate a root alias. * @return The generated root alias. */ private static String generateAliasRoot(String description) { String result = truncate( unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH ) .toLowerCase() .replace( '/', '_' ) // entityNames may now include slashes for the representations .replace( '$', '_' ); //classname may be an inner class result = cleanAlias( result ); if ( Character.isDigit( result.charAt(result.length()-1) ) ) { return result + "x"; //ick! } else { return result; } }
/** * Generates a root alias by truncating the "root name" defined by * the incoming decription and removing/modifying any non-valid * alias characters. * * @param description The root name from which to generate a root alias. * * @return The generated root alias. */ private static String generateAliasRoot(String description) { String result = truncate( unqualifyEntityName( description ), ALIAS_TRUNCATE_LENGTH ) .toLowerCase( Locale.ROOT ) .replace( '/', '_' ) // entityNames may now include slashes for the representations .replace( '$', '_' ); //classname may be an inner class result = cleanAlias( result ); if ( Character.isDigit( result.charAt( result.length() - 1 ) ) ) { return result + "x"; //ick! } else { return result; } }