Hibernate sub-database sub-table

Hibernate sub-database sub-table

transaction is performed on the same database, different databases are more difficult to implement. The transaction

connection is obtained from the database connection pool, and the connection pool will be established according to the relevant parameters at startup.

Session is the encapsulation of JDBC and transactions , the session will be associated with one of the connections, and the session will be associated with a thread, so that the transaction can be completed by the same connection.

Reference: http://aladdin.iteye.com/blog/40986 (for ThreadLocal to manage Hibernate Session)

The connection pool is managed by the SessionFactory, and the session is generated by the SessionFactory.

Establish different SessionFactory, establish the mapping table of different SessionFactory, so that you can use different SessionFactory to access different databases (different databases have the same table (for the same business and different organizations))

It is easier to divide the data than the table in the code

Reference: http://blog.csdn.net/tony8829/article/details/7680528 ( Hibernate connects to access multiple databases (including accessing the same table in different databases))
Reference: http: //www.cnblogs.com/xujian2014/p/5282335.html (Detailed steps to integrate Hibernate in Spring)


The way to divide the table is to modify the table name in SQL by AOP.
http://blog.csdn.net/sd4000784/article/details/8190993 (using hibernate sub-tables to do additions, deletions, modifications, and inquiries)


If data of different functions is placed in different databases, it is necessary to perform database mapping by function to achieve access Different database


sub- table
hibernate
EmptyInterceptor
http://blog.csdn.net/yuke98727/article/details/52757524
http://blog.csdn.net/sd4000784/article/details/8190993
http://blog.csdn.net /zhongbaolin/article/details/45077927


Sub-tables in ibatishttp:
//blog.csdn.net/cpf2016/article/details/46779203

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326554297&siteId=291194637