解决JPA 注解开发 Myeclipse 2017 C9 出现没有发现持久化单元中定义的名为 问题
2017-12-17 00:00
387 查看
摘要: Description Resource Path Location Type
No generator named "ordersTime" is defined in the persistence unit Orders.java /hibernate_maven_JPQL/src/main/java/cn/leelei/hibernate/entity line 27 JPA Problem
描述资源路径位置类型
没有发电机持久化单元中定义的名为“”命令。
目录结构:
![](https://static.oschina.net/uploads/space/2017/1217/162637_Psew_3518854.png)
注解 @GeneratedValue(generator = "xxxxx"):虽然有叉叉 但不影响结果
![](https://static.oschina.net/uploads/space/2017/1217/162812_bgcI_3518854.png)
解决方法:
![](https://static.oschina.net/uploads/space/2017/1217/163219_c5IY_3518854.png)
代码示例如下 orm.xml文件:
代码示例如下 persistence.xml 文件:
No generator named "ordersTime" is defined in the persistence unit Orders.java /hibernate_maven_JPQL/src/main/java/cn/leelei/hibernate/entity line 27 JPA Problem
描述资源路径位置类型
没有发电机持久化单元中定义的名为“”命令。
目录结构:
![](https://static.oschina.net/uploads/space/2017/1217/162637_Psew_3518854.png)
注解 @GeneratedValue(generator = "xxxxx"):虽然有叉叉 但不影响结果
![](https://static.oschina.net/uploads/space/2017/1217/162812_bgcI_3518854.png)
解决方法:
![](https://static.oschina.net/uploads/space/2017/1217/163219_c5IY_3518854.png)
代码示例如下 orm.xml文件:
<?xml version="1.0" encoding="UTF-8"?> <entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"> <entity class="cn.leelei.web.entity.Users"> <table name="users"> </table> <attributes> <id name="id"> <generated-value strategy="TABLE" /> </id> <basic name="userName"> <column name="uname" length="100" /> </basic> <basic name="passWord"> <column length="100" /> </basic> </attributes> </entity>
代码示例如下 persistence.xml 文件:
<?xml version="1.0" encoding="UTF-8" ?> <persistence version="1.0" 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"> <persistence-unit name="jpa" transaction-type="RESOURCE_LOCAL"> <mapping-file>META-INF/orm.xml</mapping-file> <!-- 添加实体对象 --> <!-- <class>cn.leelei.web.entity.Users</class> <class>cn.leelei.web.entity.Students</class> <class>cn.leelei.web.entity.Orders</class> --> <properties> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /> <property name="hibernate.connection.username" value="xxxx" /> <property name="hibernate.connection.password" value="xxxx" /> <property name="hibernate.connection.url" value="jdbc:mysql://xxxxxx:3306/xxxx" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/> <!-- 连接池 --> <property name="hibernate.c3p0.acquire_increment" value="2"></property> <property name="hibernate.c3p0.max_size" value="10"></property> <property name="hibernate.c3p0.min_size" value="5"></property> <property name="hibernate.c3p0.idle_test_period" value="3000"></property> </properties> </persistence-unit> </persistence>
相关文章推荐
- 非J2EE 容器环境下Spring +JPA 多持久化单元/多个JAR归档注解实体 的实体扫描问题及解决办法
- 使用spring和jdk1.7开发web项目时出现的注解定义pointcut的问题
- 解决PL/SQL登录时出现NLS_LANG没有定义的问题
- 使用myeclipse开发java,解决java中继承JFrame类出现The type JFrame is not accessible due to restriction的问题
- 解决Myeclipse或Eclipse出现JPA project Change Event Handler问题的解决办法
- PHPMyAdmin 出现 没有发现 PHP 的扩展设置mbstring 解决方法
- 解决MyEclipse联网编辑JSP页面出现类、方法等提示信息的时候出现死机、假死等问题的办法
- MyEclipse开发JSP页面假死问题解决办法
- 解决给定义的整型数据输入字符时出现死循环的问题
- 加入域时如果出现网络路径没有找到等问题时的解决方法
- 解决MyEclipse6.5联网编辑JSP页面出现提示信息的时候的死机、假死等问题的办法
- Delphi2007没有ActiveX Control开发向导的问题解决
- 二次开发环境执行后台事务定义中断问题解决办法
- jfreechart出现ChartDeleter没有序列化问题导致session信息丢失的解决方法
- CEikEdwin 的定义出现了问题 说没有定义
- 在myEclipse中开发J2ME程序,引用外部jar文件的问题解决
- 用Myeclipse5.5+Tomcat5.5整合Spring2.0+struts1.2时出现的兼容性问题及解决办法
- PHPMyAdmin 出现 没有发现 PHP 的扩展设置mbstring 解决方法
- myeclipse连接mysql数据库错误问题解决(搞了好久才发现是这个问题)
- MyEclipse开发Struts+Spring+Hibernate中文化问题解决