2013年9月28日星期六

About hibernate cascade operation

There is a class mapping file is as follows


.
.
.
cascade = "save-update" class = "stock.pojo.Accommodate">



red code for cascade settings.
Now the question is, I save or update an Materialpricenotify object corresponding to Accommodate data will become garbled

database is encoded as ISO jsp page encoding GBK. According to past practice, garbled only written to the database when transcoding on ok, now hibernate in cascading updates or saved , I do not know where transcoding ? Engage in three days , help for you big ox, brother Xianxie
------ Solution ------------------------ --------------------
former student of pages , databases, works with all Unicode encoding , and then go method garbled configure a filter processing , ,
------ Solution --------------------------------------- -----
transcoding in action inside the iso into it, and then spread to service when it does not achieve garbled
------ For reference only ------- --------------------------------


I tried this method , not used. I turned in Accommodate action code corresponding call the action in the save () is not garbled. But when you call Materialpricenotify action in the save () , it actually Accommodate database tables garbled. I was done on the basis of former colleagues , and now can not re- set the encoding type ah
------ For reference only ------------------- --------------------
problems have been solved a long time, forgot to settle stickers. The solution is : In the hibernate configuration file database connection transcoding ( the red part )

jdbc: mysql :/ / localhost: 3306/py_idrp_100804? useUnicode = true & characterEncoding = gbk

没有评论:

发表评论