java IntelliJ IDEA 2016:请选择持久化单元
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38100509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IntelliJ IDEA 2016: Please choose persistence unit
提问by Do Nhu Vy
回答by Robyn Liu
I've got the similar problem.Here is my solution.
我有类似的问题。这是我的解决方案。
add "JPA" facet.
open the "Project Structure" window -> click the "Facets" -> click the "add" button -> select "JPA"add JPA persistence.xml.
click "persistence" -> right click your root item in the "persistence" toolbar -> "Generate Persistence Mapping" -> "By Database Schema".
- generate entities.
添加“JPA”方面。
打开“项目结构”窗口 -> 点击“Facets” -> 点击“添加”按钮 -> 选择“JPA”添加 JPA 持久性.xml。
单击“持久性”-> 在“持久性”工具栏中右键单击您的根项目->“生成持久性映射”->“按数据库架构”。
- 生成实体。
回答by Yuechuan Xiao
you need add "hibernate.cfg.xml" first
您需要先添加“hibernate.cfg.xml”
Project Structure -> Modules -> Hibernate add hibernate.cfg.xml
项目结构 -> 模块 -> Hibernate添加 hibernate.cfg.xml