By the way, an old post about the domain object discussion

By the way, an old post: http://www.blogjava.net/GandofYan/archive/2006/05/30/48954.html discusses the domain object, where the domain logic is represented by ER modeling like this:

The establishment of Bid needs to meet 3 constraints, that's all.

There is a sentence in that post "this.getBids().add(newBid); This kind of domain logic cannot be achieved without Hibernate/JDO such as "transparent persistence" tools.". In fact, if ER modeling is used, this problem does not exist at all. At least it is inappropriate to use this example to illustrate the advantages of transparent persistence (again, the essence of transparent persistence is caching). Hibernate solves one of its own The problem created, because ER modeling does not have the concept of one-to-many like object modeling, there is no problem of maintaining associations by one party. The essence of a one-to-many association is that one party maintains a memory cache table (set, list, array, bag). By default, multiple parties are loaded into this cache during runtime, and the cache is emptied and refreshed to the database at the end. This is a kind of Early performance optimization (using L2 cache), which can cause performance problems (unnecessary loads) and increase programming complexity. For example, "a freshman in the first class of senior three" is expressed by the concept of ER as new Student("Zhang San").setClass("Class of senior three"); and the one-to-many association expression becomes getAllStudents(" Class 1 of the third year of high school").add(new Student("Zhang San")), the problem is that the logic of getAllStudents and joining freshmen are irrelevant. When joining freshmen, you must getAllStudents? Not necessarily.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326481964&siteId=291194637