How To Generate Hibernate Base Classes (3 posts)

Devdrone19
Member
Posted 1027 days ago #
How do I regenerate the Java classes from the hibernate XML description under:

floreantpos_src_1.03srccomfloreantposmodel

I guess you are using some IDE plugin to do this for you but I would prefer it to be in the ant build.xml so that everyone can do it when they download your source tarball.

I want to add some fields/classes (I want to have more than one language at once - locale specific is not enough. I have a restaurant with customers/employees speaking 2 languages)

I am willing to enhance the ant build.xml but I would like to know how you are doing this first. The generic tutorial you point to does not explain the way you are doing things in FloreantPOS; specifically the BaseXXX (generated) versus XXX (handcoded?) classes.

Devdrone19
Member
Posted 1025 days ago #
I have made some progress on learning how to generate java from hbm.xml files in Ant.

However, it seems that your hibernate.cfg.xml is not in sync with the files in com/floreantpos/model

e.g. Coupon.hbm.xml is in the hibernate.cfg.xml but not in the model directory. Instead there is a CouponAndDiscount.hbm.xml file.
There are other files not matching too.

Before I try further can you tell me if the hbm/hibernate files in the v1.0_3 tarball are correct / up to date?

Thanks
Devdrone19
Member
Posted 1025 days ago #
// Generated Aug 28, 2010 12:42:02 PM by Hibernate Tools 3.2.0.b9

The java files generated by hbm2java from your *.hbm.xml files look very different from the BaseXXX.java files you have.

Mine do not have hashCode/compareTo/equals methods or the add methods - there are other differences.

Have you used some special custom templates for hbm2java?
Can you release them and your generation tools / ant tasks for the hibernate stuff?

Thanks