Hibernate chokes on missing rows when dealing with a legacy database

后端 未结 4 1977
一个人的身影
一个人的身影 2021-02-19 09:19

I am trying to implement hibernate on a legacy database (that still has a legacy PHP client), and am running into some problems because the people who wrote the original app had

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-19 09:36

    I don't think Hibernate is a good fit for this type of problem. Hibernate expects the records in your tables to relate to each other, and really can't work if the foreign-key relationships are only sometimes enforced. I can't imagine it would be easy to change or configure Hibernate to behave this way - to know how to deal with broken foreign-key relationships.

    You may get more mileage out of a framework like MyBatis SQLMaps, in which you provide the SQL statements to load your data in files external to your program, but the framework provides options for chaining SELECT statements together to load full object graphs. This way you could supplement the SQL statements with logic to filter out the 0 values.

提交回复
热议问题