I've got a JPA/Hibernate data model that i'm while using Hibernate hbm2ddl tool to create database DDL. I've some strings that needs to be CHAR plus some that might be VARCHAR within the database. I wish to minimize hands editing from the DDL (I recognize that some will need to happen).

Anybody understand how I ought to build a storage shed? I recognize will be able to make all Strings VARCHARS or CHARS using a compromised dialect, but that is not what's always appropriate within the database.

I must have the ability to do that with annotations or aop, staying away from custom column definition text during my classes.

Thanks.

Annotate the strings you need to map to some CHAR within the database with @Column(columnDefinition="CHAR(<your-char-length>)").

So, I finally found that you could specify an overall length limit for any enter in the dialect. So, I have made the decision that anything within period of 10 ought to be char and anything over that needs to be varchar:

registerColumnType( Types.VARCHAR, 10, "char($l)" );

That is not precisely what I had been wanting, but that's adequate. Sad which i did not discover that earlier.