If you use extended identifiers:
properties.put("hibernate.id.new_generator_mappings", "true");
then SequenceStyleGenerator is used , and since MySQL does not support sequences, it will return to the TABLE generator . Therefore, it searches for "hibernate_sequence", which is the name of the default sequence table.
If you are not using new generators, then the "native" generation is used, which will look for:
public Class getNativeIdentifierGeneratorClass() { if ( supportsIdentityColumns() ) { return IdentityGenerator.class; } else if ( supportsSequences() ) { return SequenceGenerator.class; } else { return TableHiLoGenerator.class; } }
Therefore, he chooses from:
depending on your current database capabilities.
In this case, for MySQL, it will always select the identifier. See this article for more information.
source share