获取持久性单元名称 [英] Get the persistence-unit name

查看:104
本文介绍了获取持久性单元名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取Java中持久性单元的名称?我有一个包含许多单元的persistence.xml,因此我想控制使用哪个单元来创建我的EntityManager.

How do you get the name of a persistence-unit in Java? I have a persistence.xml with many units, so I want to control which unit is used to create my EntityManager.

有像getPersistenceNamesmth这样的方法吗?我搜索了一段时间,但没有找到任何有用的信息.

There's method like getPersistenceName or smth? I have searched for a while but did not find anything useful.

推荐答案

请检查此线程: 找到当前EntityManagerFactory的当前持久性单元

这篇关于获取持久性单元名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆