I try to split the database into two parts and wonder if there is a way in Hibernate to have two entity managers, but to specifically mark certain entities only so that one of the two entity managers picks them up.
Persistence.createEntityManagerFactory("default", paramsDefault.toTypedArray()))
Persistence.createEntityManagerFactory("audit", paramsAudit.toTypedArray()))
In my configuration (this is only for dev, in production we will not use hbm2dll), I have a line:
<property name="hibernate.hbm2ddl.auto" value="update"/>
What objects will be executed?
Is there a way, for example, to force this object:
@Entity()
@Table(name = "accounts")
data class Account(
@Column(nullable = false, unique = true)
var username: String = "",
@Column(nullable = false, unique = true)
var email: String = "",
....
is available only when using the default object manager and not the audit entity manager?
In other words, how to prevent the creation of a table Account
in a database audit
and an audit entity in a database default
?
source