(转)MyEclipse自动生成Hibernate实体类, oracle篇

转自http://blog.csdn.net/hejinwei_1987/article/details/9465529

1.打开 windows -> Open Perspective -> MyEclipse Java Persistence

2.新建连接。这边需要导入classes12.jar。这个文件可以直接去oracle的安装目录中查找。点Add JARs导入。导入后,Driver classname会自动帮我们填好。

3.创建好后,连接上。一直展开到用户名再到Table,再到具体的表,选中右键Hibernate Reverse Engineering..。之后就选择要生成的类所在的目录等等,按自己的需要生成了。

遇到的问题:

在上文第3步的时候,点击Browser按钮的时候出现一个灰色的窗口,没有项目可选。在网上查了下,发现是在.project中少一条,如下标红这条,加上就好了。

<natures>
<nature>com.genuitec.eclipse.hibernate.hibernatenature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>

原文地址:https://www.cnblogs.com/liusijia/p/4932735.html