Home > Back-end >  Analyze the principle of Java ORM framework, how do you?
Analyze the principle of Java ORM framework, how do you?

Time:12-17

ORM framework of Java development for many years, there has been a variety of problems, I believe you experience than I deeply, what is this? I from two angles to analyze, you see right?

1) the dualism of semantic expression

A Java Bean definition, can only express a kind of semantics, is to coordinate with other related Java classes implement a feature that is often used for the carrier of data, but cannot express semantics of SQL database interaction, two kinds of inner semantic difference is very big (for example, a Java Field mapping for the Column in the database, a Column can be sorted, arithmetic and comparison operations, etc.), it is difficult to through the Annotation, unless adding new features in Java, Java is used to describe a Class of multiple semantics, since a Java Class can't meet the double semantic description, only new code for the definition and description, and duplicate code at this time and the consistency of the changes through the Maven or APT form generation, will exist after each change, all need to run the task, can be used normally, make the development process of worse,

2) grammar consistency

Java syntax and SQL syntax semantically basic is consistent, but is different form, for example, in Java logic expressions: a & amp; & B OR a | | b, AND the SQL is a AND b OR a OR c, the expression of two types semantically consistent, but grammar cannot direct swap, at the same time, also can't Java intervention on semantic parsing AND execution process, has led to a Java expression cannot be converted to SQL expressions directly, only in the form of a string of stitching, through the process of string concatenation abstraction AND encapsulation, forming a series of API, this has led to a simple expression into some Java methods nested, seriously affected the comprehensibility of the code,

Are interested in, can visit: https://github.com/braisdom/ObjectiveSql

CodePudding user response:

I think the biggest role is to find a balance between SQL and JAVA

CodePudding user response:

Not so simple

CodePudding user response:

  • Related