保存方法中的entityName参数是什么? [英] What is entityName parameter in save method?

查看:417
本文介绍了保存方法中的entityName参数是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始学习Hibernate并有一个基本问题。
$ b $ <<> code> save(String entityName,Object object)和 save( Object对象) org.hibernate.Session 类中。
基本上我想知道这个重载方法中的 entityName 参数是什么。
我试图看看这个API,但并没有从中收集很多。

解决方案

这是一个合乎逻辑的名字一个旨在匹配映射文件中相同实体名称的实体。它默认为当前实体的类名称,但如果您提供自己的值,则可以使用具有多个不同映射文件的相同类。

href =http://www.martinahrer.at/2008/04/09/55/ =nofollow> http://www.martinahrer.at/2008/04/09/55/ 和 http://docs.jboss.org/hibernate/ orm / 3.3 / reference / en / html / mapping.html http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/persistent-classes.html#persistent-classes-dynamicmodels http://docs.jboss.org/hibernate/ orm / 3.3 / reference / en / html / xml.html (在每种情况下搜索entity-name)。


I have started learning Hibernate and have a basic question.

What is the difference between save(String entityName, Object object) and save(Object object) in the org.hibernate.Session class. Basically I want to know what the entityName parameter is in this overloaded method. I tried to look at the API but didn't glean much from there.

解决方案

It's a logical name for an entity intended to match the same entity-name in a mapping file. It defaults to the class name for the current entity, but if you provide your own value, then you can use the same class with multiple different mapping files.

See http://www.martinahrer.at/2008/04/09/55/ and http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/mapping.html and http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/persistent-classes.html#persistent-classes-dynamicmodels and http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/xml.html (search for "entity-name" in each case).

这篇关于保存方法中的entityName参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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