使用
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, hibernateReactiveProperties());
Mutiny.SessionFactory reactiveSessionFactory = emf.unwrap(Mutiny.SessionFactory.class);
但是没有实体被扫描,尽管它们用CCD_ 1注释标记。我想知道是否应该有一个地方来配置包以扫描EntityManagerFactory
?
春季有LocalSessionFactoryBean
及其设置器setPackagesToScan("com.123.123")
通过为persistence.xml 中的每个实体添加class
标签来解决
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="default" >
<provider>org.hibernate.reactive.provider.ReactivePersistenceProvider</provider>
<class>com.company.EntityClassName</class>
</persistence-unit>
</persistence>