When do we really need to use sleep mode for our Java code?

As a newbie to Java database projects, how to decide when to use Hibernate in Java code instead of plain jdbc?

+7
source share
2 answers

Use sleep mode if completed 1 - 4

  • If you are developing a database schema and domain objects again.
  • You assume that your domain objects and your schema will be synchronized, for example, a car provider application, where your vehicle objects are likely to be close to your table structures. Just an example.
  • You really want to use ORM and bind your objects to a schema.
  • Want to use the ORM structure to handle connections, etc.

Else

I would recommend ibatis. This is still an ORM structure, but leaves flexibility in handling schema and domain objects. It provides great flexibility when processing requests, etc.

Spring jdbc also has some nice features that offer flexibility. But I feel that it is not yet close to ORM. But spring offers templates for processing orms like hibernate and ibatis.

+5
source

Basically, if your application needs to store some data, you probably want to use ORM (for example, you created some kind of business application for your company, and you need to track users and accounts). If your application is your data, then you probably want to use JDBC (for example, you created a data warehouse for your company).

as an additional note, it is only natural that an application can use both ORM and JDBC. if, for example, you created a webapp that allowed users to access your data warehouse, you could manage user / account information using ORM, but use JDBC to interact with the data warehouse.

+2
source

All Articles