Hibernate Notes

xiaoxiao2021-03-06  51

Useful Note

1. Generally, PO on the Model layer will not be referenced by other levels, as this is directly related to records corresponding to the database, but if the performance layer

You need to refer to Value to change the PO, you can use the DTO (Data Transfer Object) to transmit the ValueObject of the performance layer.

2. Because Hibernate is in OpenSession, get the transaction process equivalent to the JDBC's Connection Setting SetAutocommit (FALSE);

Therefore, while hibernate's Transaction is essentially in a connection of Transaction, then transaction in JTA is equivalent to

Transaction across multiple Connection. Therefore, do not use Hibernate Transaction when using JTA's Transaction, otherwise an error will occur.

3. Pessimism is used or the bottom of the database is supported, otherwise the data will still be modified.

4. The FOR after the database in the database is actually a locking operation.

5.Hibernate's query.list and query.iterator's difference is that the former doesn't have to use SELECT directly.

The statement takes the content in the database from the database, and query.iterator is not extracted like List.

Data, but take data from cache, and no data like List is obtained at once.

转载请注明原文地址:https://www.9cbs.com/read-59697.html

New Post(0)