myeclipse下整合spring和hibernate(编辑修改稿)内容摘要:
,程序会向表 Content插入 100 条记录。 祝你好运。 ,现在也贴出来,希 望对大家有所帮助: 如果运行时出现如下异常 Could not find UserTransaction in JNDI :… 解决: 把配置文件“ ”中的 property name= /property property name= java:p/UserTransaction /property 两行设置 JTA控制事务的属性注释掉就可以了,因为程序里还未使用 JTA控制事务。 如果运行时出现如下异常 Error parsing XML: /(33) The content of element type sessionfactory is inplete, it must match (property*,mapping+,(classcache|collectioncache|jcsclasscache|jcscollectioncache)*). 解决: 在 配置文件“ ”中的 sessionfactory与 /sessionfactory之间加 mapping resource= / 第一次写关于 Hibernate 的文章,如有不对的地方,请批评指正。 最后,祝大家成功。 ^_^ hibernatesynch On this page, I will walk through a few features of the plugin and how it is intented to work. Create a Configuration File Create a Java project and add the jar containing the driver in the project39。 s build path. Start the wizard by clicking File New Other Hibernate Configuration File. Select the default package for the file container and let the wizard do the rest. Create Mapping Files Start the wizard by clicking File New Other Hibernate Mapping File. Set the database information and click Refresh. Select any tables you would like to create mapping files for. Set the package you would like the business objects to reside in. Select the mapping files in the navigator, right click and select Hibernate Add Mapping Reference. Use the Generated Objects Assuming a simple example like person, the following snippet is an example of how the generated code can be used: // load the configuration file ()。 PersonDAO dao = new PersonDAO()。 // find all people List people = ()。 // find a single person Long id = new Long(3)。 Person person = (id)。 // update the person (Joe)。 (person)。 // delete the person (id)。 Spring+Hibernate+Junit+Oracle 的最简单的人门 一年前,就计划学习 Spring,但初步 了解一下,发现还是有些庞大,就知难而退了。 最近反思一年来开发进展迟缓的原因,发现技术学习上比较保守,是重要原因。 学习主流的开发技术,虽然有学习成本,但会有开发效率的提升。 第一个目标:用 Spring+ Hibernate 完成对持久层的改造,这是 Spring 最迷人的应用之一吧。 Spring 比较复杂,有七大部分,比如 ORM/MVC/WEB 等等,我想,应该分步学习,有些部分可能我以后也不打算学习,比如其 MVC 部分。 首先,作一点理论准备。 SpringFramework 的官方站点查阅资料,初步了解一下 IOC,AOP这些 SpringFramework 力推的核心概念。 阅读了官方手册,以及《 Spring In Action》的部分内容,以及 Martin Fowler 谈 IOC(Dependency Injection)的文章。 其次,寻找可用的入门教程,最后锁定了 IBM developworks 上的一篇文章,以及 SpringFramework 自带的 petclinic 作为实战材料。 Objectrelation mapping without the container- Develop a transactional persistence layer using Hibernate and Spring 这篇文章非常符合我的目标。 透明思考称该文的作法是: “ Spring 结合 Hibernate 的标准做 法”。 我的开发环境是: Jbuilder X+Oracle 8i +Jboss ,操作系统是 TurboLinux Server。 下载 Richard HighTower 的源代码。 让这个例子运行起来,居然费了我一整天的时间。 HighTower 的例子,其数据库用的是 Mysql,而我的是 Oracle 8i,单单这个差别,就浪费了我一天的时间,因为 Dbunit 操作 Mysql 与 Oracle 有些细节地方不同,就会导致运行失败。 为了让和我一样的初学者少走点弯路,下面给出我改造过的例子,尽可能的简 化再简化,因此本例特地只使用一个数据库表: hofman_user。 1. 建立数据表 create table hofman_user (pk_user_id number(8), vc_ varchar2(50), vc_password varchar2(80), primary key(pk_user_id))。 2. 建立 hofman_user 表主键 pk_user_id 使用的序列 create sequence hofmanid_seq。 3. 一个数据表对应一个 POJO: package hofman。 import。 import。 public class User { private Long id = new Long(1)。 private String。 private String password。 public Long getId() { return id。 } public void setId(Long long1) { id = long1。 } public String getEmail() { return。 } public String getPassword() { return password。 } public void setEmail(String string) { = string。 } public void setPassword(String string) { password = string。 } } 4. 对应的 hibernate 的映射文件: ?xml version=? !DOCTYPE hibernatemapping PUBLIC //Hibernate/Hibernate Mapping DTD hibernatemapping class name= table=HOFMAN_USER dynamicupdate=false dynamicinsert=false discriminatorvalue=2 id name=id column=PK_USER_ID type= unsavedvalue=1 generator class=sequence param name=sequencehofmanid_seq/param /generator /id property name= type=string update=false insert=true column=VC_EMAIL length=82 notnull=true unique=true / property name=password type=string update=false insert=true column=VC_PASSWORD length=20 notnull=true unique=true / /class query name=AllUsers![CDATA[ from User user order by asc ]]/query /hibernatemapping 5. UserDAO 的 interface 文件: package hofman。 import。 public interface UserDAO { public List getUsers()。 public void addUser(User user)。 public User findUserByEmail(String )。 public void removeUser(String )。 } 6. UserDAO 的实现文件: package hofman。 import。 import。 import。 import。 import。 import。 import。 import。 public class UserDAOImpl extends HibernateDaoSupport implements UserDAO{ public List getUsers(){ return getHibernateTemplate().findByNamedQuery(AllUsers)。 } public User findUserByEmail(String ) { return (User) getHibernateTemplate().find(from User u where =?,).get(0)。 } public void addUser(User user){ getHibernateTemplate().save(user)。 } public void removeUser (String ) { User user = findUserByEmail()。 ().delete(user)。 } } 7. SpringFramework 的配置文件: . ?xml version= encoding=UTF8? !DOCTYPE beans PUBLIC //SPRING//DTD BEAN//EN ! Application context definition for Express on Hibernate. beans ! bean id=dataSource class= property name=jndiName valuejava:/p/env/jdbc/OracleDs/value /property /bean ! Datasource that works in any application server You could easily use J。myeclipse下整合spring和hibernate(编辑修改稿)
相关推荐
页 ”。 单击右侧的 “文件 ”按钮,在出现的 “链接到文件 ”对话框中从 “我的文档 ”中找到 “我的文件 ”并双击, Flash 动画的路径便自动出现在 “插入超级链接 ”对话框中,最后单击 “确定 ”返回 PPT。 3)放映该幻灯片,当鼠标单击设置了超级链接的对象 时,会出现一询问框,单击 “确定 ”,系统便会调用 Flash 程序来播放动画。 四、动作设置法 1)运行 PPT 2020
ng 以手掌推挡对方进攻球员之犯规动作 held ball 持球 illegal defense 防守违例 illegal offense 进攻违例 jump ball 争球,跳球 loose ball foul 双方均无持球权时的犯规 offensive basket interference 进攻方干扰投篮得分 out of bound 球出界线 overtime 加时赛 referee
limited] [/remark:text] 参数介绍: (1)键入不带参数的 share 显示本地计算机上所有共享资源的信息。 (2)sharename 是共享资源的网络名称。 (3)drive:path 指定共享目录的绝对路径。 (4)/users:number 设置可同时访问共享资源的最大用户数。 (5)/unlimited 不限制同时访问共享资源的用户数。 (6/remark:text
A20 全为 md;选中 B1,用鼠标拖动右下角的填充柄向下拉到 B20,结果从 B1 到 B20 为 Disk001 到 Disk020 序列。 然后选择保存,在保存对话框中选择保存类型为 MSDOS 文本文件,文件名为 ,即批处理文件。 系统会提示你不能保存格式,不要理会它,选择“确定”即可。 退出 Excel。 将 文件复制到你需要创建目录的地方,执行它 ,你的序列目录就自动创建好了。 二
ake 文件夹下。 用户可以自己添加模块,也可利用原有的 lst 和 pth 文件添加。 以下以添加在 MTK\make\plutommi 为例。 167。 裴167。 19:12:23 .inc 起的作用和 # include 差不多 167。 裴167。 19:13:03 .def 也和 ifdef 添加头文件路径: 添加本模块路径: 添加源文件路径: 添加完毕,这些文件就可参与编译了。
依靠精力集中,通过全面性和可靠性获得成功。 注重实践、有秩序、实事 求是、有逻辑、现实、值得信赖。 他们自己决定该做什么并不愿反对和干扰, 并 坚定不移 地朝着目标前进,不易分心。 喜欢将工作、家庭和生活都安排得井井有条。 重视传统和忠诚。 适合职业 首席信息系统执行官 天文学家 数据库管理 会计 房地产经纪人 侦探 行政管理 信用分析师 ISFJ 型 少言、友善、 有责任感和良知。