I’m annotating my DAOs and using hibernate3:hbm2ddl to generate the ddls. Is there a way to annotate the tablespace?
I’m annotating my DAOs and using hibernate3:hbm2ddl to generate the ddls. Is there a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is no way to do it out of the box. I’ve got around it in the past using the following – rather involved – approach:
@TableSpecthat has tablespace and other necessary attributes.org.hibernate.cfg.Configurationand overridegetTableMappings()to return decoratedTableobjects (see below).org.hibernate.mapping.Tableand overridesqlCreateString()and / orsqlAlterStrings()to append tablespace specification (and additional settings if any).Configurationobject, process all your class files collecting and interpreting your@TableSpecannotations and invokeConfiguration.generateSchemaCreationScript()orgenerateSchemaUpdateScript()to generate actual DDL.As I said, rather involved 🙂 As an alternative, if ALL your mapped tables use the same tablespace, you can extend Oracle dialect you’re using and override
getTableTypeString()to return your tablespace spec. While this is an ugly hack (because tableTypeString’s original purpose is to provide MySQL engine type), it works and is certainly a lot faster and easier than above approach.