Hibernate automatically creates a database table. Instead of creating a login user space, it creates a System space.
Hibernate automatically creates a database table. Instead of creating a login user space, it creates a System space.
Problem description: Hibernate automatically creates a database table. Instead of creating a login user space, it creates a System space.
Logon User: penw
Recently, in phase II of the project, the database needs to be transferred from Mysql to Oracle. Therefore, the entity class needs to be restructured to implement hibernate's automatic table creation function.
For example, users, roles, permissions, and intermediate tables between them:
@ ManyToMany (targetEntity = Power. class, cascade = {CascadeType. PERSIST,
CascadeType. MERGE })
@ JoinTable (name = "ACC_ROLE_POWER", joinColumns ={@ JoinColumn (name = "role_id")}, inverseJoinColumns ={@ JoinColumn (name = "power_id ")}, uniqueConstraints = @ UniqueConstraint (columnNames = {
"Role_id", "power_id "}))
The entity class has been compiled, but when I started the server, I found that all the tables ran to the System user tablespace, instead of the User table I specified. After checking, it is found that Oracle and Mysql are different. You need to add schema = "penw" in the annotation to specify the space. Therefore, the problem can be solved successfully after the annotation is added.
The Code is as follows: