在 spring 项目中使用 hibernate 工具
我有一个带有 spring.xml 数据源设置的现有项目。
xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="url"
value="jdbc:oracle:thin:@xxx:1511:xxx"/>
<property name="driverClassName"
value="oracle.jdbc.OracleDriver"/>
<property name="username" value="xxx"/>
<property name="password" value="xxx"/>
</bean>
在 eclipse 中如下所示,我单击 new -> other-> hibernate ->休眠控制台配置。如何使用 eclipse 内的 hibernate 工具使用上面的 spring.xml 文件设置连接到数据库?或者有没有办法在 eclipse 内的 hibernate 控制台中手动输入这些设置以连接到数据库,以便我可以对数据库表进行逆向工程?
i have existing project with datasource setup with spring.xml .
the xml look like below
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="url"
value="jdbc:oracle:thin:@xxx:1511:xxx"/>
<property name="driverClassName"
value="oracle.jdbc.OracleDriver"/>
<property name="username" value="xxx"/>
<property name="password" value="xxx"/>
</bean>
inside eclipse, i click new ->other->hibernate-> hibernate console configuration. how to use hibernate tool inside eclipse to connect to database using setting of spring.xml file like above? or is there way to manually enter those setting in hibernate console inside eclipse to connect to database so that i can do reverse engineering on database table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
先安装hibernate工具:
可以看用于屏幕截图的 Hibernate 工具设置
这是一个示例文件,您可以使用它,因为只需输入数据库凭据即可
使用上述文本创建 hibernate.cfg.xml 文件,并在配置 hibernate 工具时导入它
Install hibernate tools first:
you can look at Hibernate Tools setup for screen shots
here is a sample file which you can use as it as just entering your DB credentials
create hibernate.cfg.xml file with the above text and import it while configuring hibernate tools
您可以使用属性标签在 hibernate.cfg.xml 中输入这些配置,
请参阅 此处 获取您可以配置的值列表。
you can enter these configurations in hibernate.cfg.xml using the property tags
refer here for a list of values you can configure..