栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何使用JPA /休眠自动注册实体:未知实体

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何使用JPA /休眠自动注册实体:未知实体

事实证明这很简单:直接在persistence.xml文件中列出这些类。armandino和MikelRascher都使我得到了这个答案,尽管这是间接的,但对他们来说却是支柱。

这是我现在正在使用的persistence.xml:

<?xml version="1.0" encoding="UTF-8"?><persistence xmlns="http://java.sun.com/xml/ns/persistence"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"  version="1.0">    <persistence-unit name="crm">        <provider>org.hibernate.ejb.HibernatePersistence</provider>        <class>com.example.Language</class>        <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> <property name="hibernate.connection.url" value="jdbc:mysql://localhost/crm"/> <property name="hibernate.connection.username" value="myuser"/> <property name="hibernate.connection.password" value="mypass"/> <property name="hibernate.c3p0.min_size" value="5"/> <property name="hibernate.c3p0.max_size" value="20"/> <property name="hibernate.c3p0.idleTestPeriod" value="30"/> <property name="hibernate.c3p0.timeout" value="0"/> <property name="hibernate.c3p0.max_statements" value="0"/> <!--property name="hibernate.show_sql" value="true"/>--> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.query.jpaql_strict_compliance" value="false"/> <property name="hibernate.validator.apply_to_ddl" value="false"/> <property name="hibernate.validator.autoregister_listeners" value="false"/> <property name="hibernate.archive.autodetection" value="class, hbm"/> <property name="hibernate.hbm2ddl.auto" value="create"/>        </properties>    </persistence-unit></persistence>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/409360.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号