hibernate与数据库交互的时序图

发布于 2024-10-17 03:29:51 字数 126 浏览 2 评论 0原文

我需要为 hibernate 和任何数据库的交互创建一个通用序列图。

它需要非常通用并适用于hibernate和数据库之间的所有事务

打开、获取数据和关闭与数据库的hibernate会话涉及的主要方法是什么

I need to create a general sequence diagram for the the interaction of hibernate and a any database.

It needs to be very generic and application to all transaction between hibernate and database

What are the main methods involved in opening, fetching data and closing of a hibernate session with the database

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

热血少△年 2024-10-24 03:29:51

序列图显示了一些对象实例之间的关系,您介意哪些?在某种程度上,它只是一个数据库和一个休眠应用程序。在这种情况下,您只需完成以下操作:打开、获取(或其他查询)、关闭。

现在想必您想要比这更多的细节,但我认为我们需要知道您为什么要绘制此图。谁会读这篇文章,他们对什么感兴趣?考虑这个简单的教程,它们显示了一个代码片段:

SessionFactory sessionFactory = new
Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction transaction = session.beginTransaction();
BallPlayer aPlayer = (BallPlayer) session.get(BallPlayer.class, 1L);
transaction.commit();
session.close();

所以现在我们有几个有趣的对象,SessionFactory、Session等等。对于即将使用 Hibernate 的程序员来说,这可能很有趣。对于 DBA 来说也许不那么重要?您可以很容易地绘制上述代码片段的序列图,并且它有一定的道理。我无法理解这样的图表的价值,但那是另一个故事了。

A sequence diagram shows relationships between some object instances, which ones do you have mind? At one level it's just a database and a hibernate application. In which case you've just done it: Open, Fetch (or other query), Close.

Now presumably you want more detail than this, but I think we need to know why you're drawing this diagram. Who is going to read this, what are they interested in? Consider this this simple tutorial, they show a code snippet:

SessionFactory sessionFactory = new
Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction transaction = session.beginTransaction();
BallPlayer aPlayer = (BallPlayer) session.get(BallPlayer.class, 1L);
transaction.commit();
session.close();

So now we have several interesting objects, SessionFactory, Session and so on. For a programmer about to work with Hibernate this might be interesting. For a DBA maybe less so? You can quite easily draw a sequence diagram of the above snippet, and it has some truth in it. I can't understand the value such a diagram, but that's another story.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文