站内搜索: 请输入搜索关键词

当前页面: 开发资料首页J2EE 专题求助,区分EJB、Hibernet和Ruby的区别和联系。

求助,区分EJB、Hibernet和Ruby的区别和联系。

摘要: 求助,区分EJB、Hibernet和Ruby的区别和联系。


请问EJB、Hibernet和Ruby三者之间的区别和联系。另外我觉得既然jsp+servlet+javabean+mysql已经能实现数据库连接,为何还要开发上面三种技术?

还有,我想问,如果我想在eclipse或者netbean上面开发上面三种模式的程序,需要安装什么插件?如何安装?

最后,我想问我现在在学习java,我觉得我现在越来越觉得精力不够,上面三种技术哪怕是一个很简单的演示程序都常常调不好,要花费大量时间来调试。我想问该怎么学才能学好java。


ejb 和hibernate都能对数据库映射,但ejb是分布式的,比如银行,机场的系统.hibernate只是对数据或者说sql语句进行封装和映射,他们都大大提高了开发效率.Ruby没接触过

虽然ejb和hibernate很强但是如果在做大型系统时不能驾御他们,运行效率上来看还不如不用,所以现在有很多做大系统的还是用jdbc+jsp+servlet+javabean.

eclipse装myeclipse就够了,上面的几乎都有了,netbean没用过
其实ejb hibernate配置是很麻烦的慢慢来吧,熟了就好了


upup!!!!


多谢

Ruby是什么冬冬呢?


可以看我的blog的文章.有介绍的


Ruby是个日本人写的东西,算是一种新的语言,开发高效,挺流行的,但我不用


EJB一般都是用在大型项目中,如果你用EJB做过项目,找工作的时候会很有说服力,因为EJB属于J2EE中最难的部分(高级编程)。所以各位最好找工作的时候能够清楚项目中是否用到了EJB。


我在使用myeclipse编写hibernate试验程序时遇麻烦,请高人指点:
编写一个读取数据库数据的程序,编译没问题,运行总是报错:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate Exceptionemployee is not mapped. [from employee as e order by e.EMPID asc]
Hibernate Exceptionorg.hibernate.hql.ast.QuerySyntaxError: employee is not mapped. [from employee as e order by e.EMPID asc]
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: org.hibernate.hql.ast.QuerySyntaxError: employee is not mapped. [from employee as e order by e.EMPID asc]
at com.genuitec.hibernate.Queryhib.main(Queryhib.java:67)
Caused by: java.lang.RuntimeException: org.hibernate.hql.ast.QuerySyntaxError: employee is not mapped. [from employee as e order by e.EMPID asc]
at com.genuitec.hibernate.Queryhib.getEmployee(Queryhib.java:44)
at com.genuitec.hibernate.Queryhib.main(Queryhib.java:62)
Caused by: org.hibernate.hql.ast.QuerySyntaxError: employee is not mapped. [from employee as e order by e.EMPID asc]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.genuitec.hibernate.Queryhib.getEmployee(Queryhib.java:32)
... 1 more
Caused by: employee is not mapped.
at org.hibernate.hql.ast.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:85)
at org.hibernate.hql.ast.FromElementFactory.addFromElement(FromElementFactory.java:77)
at org.hibernate.hql.ast.FromClause.addFromElement(FromClause.java:67)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:217)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2830)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2719)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:513)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:371)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
... 8 more
——————————————————————————————————
源代码如下:
package com.genuitec.hibernate;

import java.util.Iterator;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.genuitec.hibernate.SessionManager;
import com.genuitec.hibernate.Employee;;


public class Queryhib {
public void getEmployee()
{
/*
* Use the ConnectionFactory to retrieve an open
* Hibernate Session.
*
*/
Session session = null;
try
{
session = SessionManager.currentSession();
Transaction newTransaction=session.beginTransaction();
Query messages=session.createQuery("from employee as e order by e.EMPID asc");
/*
* Build HQL (Hibernate Query Language) query to retrieve a list
* of all the items currently stored by Hibernate.
*/
List messages_list=messages.list();
System.out.println(messages_list.size()+" message(s) found:");
for (Iterator iter=messages_list.iterator();iter.hasNext();){
Employee employee=(Employee)iter.next();
System.out.println(employee.getEmpid()+"; "+employee.getName()+"; "+employee.getDept()+"; "+employee.getEmail());
}
newTransaction.commit();
session.close();
}
catch (HibernateException e)
{
System.err.println("Hibernate Exception" + e.getMessage());
throw new RuntimeException(e);
}
/*
* Regardless of whether the above processing resulted in an Exception
* or proceeded normally, we want to close the Hibernate session. When
* closing the session, we must allow for the possibility of a Hibernate
* Exception.
*
*/
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try{
Queryhib Qh=new Queryhib();
Qh.getEmployee();
}
catch (Exception ex)
{
System.err.println("Hibernate Exception" + ex.getMessage());
throw new RuntimeException(ex);
}

}

}



↑返回目录
前一篇: Weblogic 8.1 配jdk1.5就跑不起来,jdk1.4就可以? 奇怪./左边的快速页面是红色的小叉...看不到.
后一篇: java_ee_sdk-5_01-windows.exe 安装后