When Hibernate's ReverseEngineering is used to automatically generate the Hibernate ing file, two class files are generated because the view does not have a primary key, one of the c
When Hibernate Reverse Engineering is used to automatically generate the Hibernate ing file, two class files are generated because the view does not have a primary key, one of the c
SELECT count (expscore) as count, sum (expscore) as sum, max (expscore) as max, min (expscore) as min, round
(Avg (EXPSCORE) * 1000)/1000 as avg, a. EXPACTID, B. teachercode, B. expname, c. classid, a. scoresubmit, a. scoreverify, c. schoolid
FROM expscore a, EXPACTIVATED B, schoolmajorclass c
Where a. expactid = B. expactid and B. schclassid = c. schclassid
Group by a. EXPACTID, B. teachercode, B. expname, c. classid, a. scoresubmit, a. scoreverify, c. schoolid
This is an SQL statement created for a view. The view creation statement is omitted.
When Hibernate's Reverse Engineering is used to automatically generate the Hibernate ing file, two class files are generated because the view does not have a primary key, and one class file is another Id, to use the decimal point and control the digits of the decimal point, I use the following method:
1. When an attempt is created, round (avg (EXPSCORE) * 1000)/1000 as avg is used to control the number of decimal places;
2. Modify the attributes in the generated ***. hbm. xml file, for example
To:
3. Modify the class file of the primary key id to automatically generate a variable declared as Long and change it to the Double type.
4. Do not forget to add the new *. hbm. xml configuration file in Hibernate. cfg. xml.