A generic mapping should only contain type information without specific column detail,for example:<column name="code" type="string">.
A specific mapping contain column information, eg:<column name="code" type="string" sql-type="varchar" length="10">
Here is my confusion: Should this mapping being generic? if it’s generic, it’ll be easy to change database underground. But, I want to keep database detail in mapping files, which makes recreate database easier.
If you recreate the DB from your java classes, then be specific.
If you have a separate sql script to create the DB, the extra detail is just noise.
Some non-requested advice (but I think your question hits this point in the face): from my experience, I think that creating the DB from the mappings is not good, as you can add more detail to your sql scripts (extra indexes, triggers, comments!, and other sorts of DB black magic). And going forward, how are you going to update that DB? Hiberante can update a schema but the process that does that is full of bugs. What are you going to do if you need to roll back?
Just in case, what I mention above only applies if you’re doing a commercial application. If you’re doing something for fun / school / university, then you won’t need to care about updates and rollbacks.