W
weiruiping
Unregistered / Unconfirmed
GUEST, unregistred user!
将hibernate部署出weblogic,接口类的代码如下:
public HashSet getGroups(String parentId)
{
System.out.println("enter getgroups"
try
{
if (session.isConnected()) {session.disconnect();}
session.reconnect();
String hql = null;
if ((parentId == null) || (parentId.equals(""))
{
hql = "from SysGroup where parentid is null";
}
else
{
hql = "from SysGroup where parentid='"
+ parentId + "'";
}
System.out.println(hql);
System.out.println("session.createQuery(hql)"+session.createQuery(hql));
Query query = session.createQuery(hql);
System.out.println("getGroups Query completed"
HashSet set = new HashSet();
System.out.println("11111111"+query.getQueryString());
Iterator it = query.iterate();
//!!!!!!!!!!!!!!!!!!!!!!!!!!该语句出现问题,weblogic中,只看到Hibernate产生的SQL语句输出,之后再也没有任何语句输出,也没有异常抛出
if(null!=it)
System.out.println("it ====="+it.toString());
else
System.out.println("it is null"
while (it.hasNext())
{
System.out.println("2222222"
SysGroup group = (SysGroup) it.next();
System.out.println(group);
set.add(group);
}
System.out.println("getGroups return"
return set;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
finally
{
try
{
if (session.isConnected()){session.disconnect();}
}
catch (HibernateException ex)
{
}
}
}
利用该接口连接Mysql数据库,Weblogic的数据源和Hibernate连接均试过了,此接口用单元测试完全正常,部署在weblogic后,jsp调用Action,weblogic无任何异常抛出,程序也没有捕获任何异常,action代码执行了一半就中止了,jsp提示500错误
public HashSet getGroups(String parentId)
{
System.out.println("enter getgroups"
try
{
if (session.isConnected()) {session.disconnect();}
session.reconnect();
String hql = null;
if ((parentId == null) || (parentId.equals(""))
{
hql = "from SysGroup where parentid is null";
}
else
{
hql = "from SysGroup where parentid='"
+ parentId + "'";
}
System.out.println(hql);
System.out.println("session.createQuery(hql)"+session.createQuery(hql));
Query query = session.createQuery(hql);
System.out.println("getGroups Query completed"
HashSet set = new HashSet();
System.out.println("11111111"+query.getQueryString());
Iterator it = query.iterate();
//!!!!!!!!!!!!!!!!!!!!!!!!!!该语句出现问题,weblogic中,只看到Hibernate产生的SQL语句输出,之后再也没有任何语句输出,也没有异常抛出
if(null!=it)
System.out.println("it ====="+it.toString());
else
System.out.println("it is null"
while (it.hasNext())
{
System.out.println("2222222"
SysGroup group = (SysGroup) it.next();
System.out.println(group);
set.add(group);
}
System.out.println("getGroups return"
return set;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
finally
{
try
{
if (session.isConnected()){session.disconnect();}
}
catch (HibernateException ex)
{
}
}
}
利用该接口连接Mysql数据库,Weblogic的数据源和Hibernate连接均试过了,此接口用单元测试完全正常,部署在weblogic后,jsp调用Action,weblogic无任何异常抛出,程序也没有捕获任何异常,action代码执行了一半就中止了,jsp提示500错误