Friday 15 February 2013

java - Hibernate and SQL portability -


I'm new to firmness and I'm reading "Pro JPA2" book. I have read that the problem of Java and JDBC pack is that

  1. SQL is not portable
  2. Better coupling between Java code and SQL

    The irony of JDBC is that, although programming interfaces are portable, SQL is not language. Despite many attempts to standardize it, it is still rare that SQL will run unchanged on any two major database platforms of any complexity. Even where SQL bids are the same, each database performs differently depending on the structure of the query, in most cases, vendor-specific tuning is required.

    My questions are:

    1. Is the problem related to SQL Portability still so important?
    2. As I have understood, hibernate, toplink and other frameworks are also to make SQL queries from their metadata (annotation). How do they handle issues related to SQL Portability?
    3. Java & amp; JDBC tight-coupling means that the developer has to write SQL queries. Do I understand it correctly?

      Thank you in advance for your responses)

      1. Yes, the problem lies with the hard work between the SQL and the code and is very important for the project because if we need to move from one database to another without the ORM, then we need to change all the questions in the application. .

      2. Hibernate, toplink and other ORM solutions convert your java code into SQL queries and send them to the database, but they work directly Rather than being tested more standard and well. We can rely on the ORM tool that will change our code into queries and complexity will give us the intangibility. Therefore it is a good idea to use ORM tools instead of writing words directly.

      3. Yes, Java & amp; JDBC tight-twitching means that the developer has to write straight to SQL queries which are not portable, and at times if the database level changes, then you need to change all the questions. If you use an ORM solution instead, you can migrate some XML or configuration files directly into any database supported by ORM.

No comments:

Post a Comment