There are many open-source benefits, which lowers the barrier for us to access high-end products in the industry and simplifies the development complexity to a certain extent. However, it also brings many problems, the use of open source means that you have to bear the consequences of its instability. Looking back at the pitfalls that have been put on these days, they are all tears... Fortunately, I am not using it alone, but I can use Google more.
I will not commit any mistakes in the future:
Hibernate can use xml configuration to automatically generate tables by classes. After SSH is used, it will not work with the original configuration. It turns out that I am in <prop key = "hibernate. hbm2ddl. auto "> Create </prop> is not caused by the addition of hibernate. After the addition, the table cannot be automatically created through update until it is changed to create. It took a lot of time to find this error, this should be a spring bug.
<Property name = "hibernateproperties">
<Props>
<Prop key = "hibernate. dialect"> org. hibernate. dialect. mysqldialect </prop>
<Prop key = "hibernate. show_ SQL"> true </prop>
<Prop key = "hibernate. format_ SQL"> true </prop>
<Prop key = "hibernate. hbm2ddl. Auto"> Create </prop>
</Props>
</Property>
In some database operations, there are also a lot of pitfalls listed below, especially the third, which will only be integrated for a whole night and will not be committed in the future.
Exception 1: Not-NullProperty referencesNullOrTransientValue
Solution: Set "one" in the "one-to-many" relationship,Not-NullSetFalse
Exception 2: org. hibernate. transientobjectexception: Object references an unsaved transient instance
Solution:Cascade = "Save-Update, persist"
Exception 3: org. hibernate. queryexception: cocould not resolve property
Solution: "From category where category. userid =: userid "changed to" from category whereuserid =: userid "or" from category where category. user. id =: userid"
exception 4: cocould not initialize proxy-the owning session was closed
solution: set lazy to false