我正在开发struts 2和hibernate 3中的应用程序.
我有3张桌子
Inspection
与...相关联InspectionMission
并InspectionMission
与之相关联Timeline
.
现在我有以下问题.我在HQL中编写了以下查询
public List getQuartewiseInspectionList(){
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
Query q = session.createQuery(
"select count(i.inspectionId) as tot_inspections,t.year,t.quarter" +
" From Inspection as i " +
" inner join i.inspectionMission as im inner join im.timeline as t" +
" GROUP by t.year,t.quarter");
return q.list();
}
Run Code Online (Sandbox Code Playgroud)
我想获取结果如下
result[0][tot_inspections] = "6"
result[0][year] = "2009";
result[0][quarter] = "Q2";
result[1][tot_inspections] = "3"
result[1][year] = "2009";
result[1][quarter] = "Q3";
Run Code Online (Sandbox Code Playgroud)
等等,以便我可以在jsp struts中显示它,如下所示:
在JSP中,我编写了以下代码 …
我想使用hibernate HQL执行数据时间操作.
我想添加和减去两个日期以及我想从特定日期减去1年或1个月.
如何在hibernate中使用HQL?
我正在尝试将内容从工作站推送到服务器.但它给了我一个错误.请查看以下命令和错误:
Administrator@ganesh ~/testing
$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 241 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: ENV GL_RC not set
remote: BEGIN failed--compilation aborted at hooks/update line 20.
remote: error: hook declined to update refs/heads/master
To git@ganesh:repositories/testing
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'git@ganesh:repositories/testing'
Run Code Online (Sandbox Code Playgroud)
看来我需要设置环境变量GL_RC
.是这样吗?
这里的任何人都可以告诉我问题可能是什么以及我如何解决它?我在Windows Server 2003上使用gitolite.
我想使用java,struts2和ajax进行文件下载.
在我的html页面上有一个名为"export"的按钮点击将执行ajax调用,该调用将执行查询并将使用代码创建.xls文件,我想将该文件下载给用户而不将其存储在硬盘驱动器上.
有没有人知道如何在java中使用struts2和ajax?
有没有可用的例子?
如果您需要我的更多详细信息,请告诉我......
谢谢.
amar4kintu
是否为struts 2动作类提供了可以在该动作类的每个方法之前调用的init方法?
例如,我有一个struts 2的动作类,如下所示
import com.opensymphony.xwork2.ActionSupport;
public class EmployeeAction extends ActionSupport{
private DepartmentDaoService deptService = new DepartmentDaoService() ;
private EmployeeDaoService empService = new EmployeeDaoService();
private Employee employee;
private List<Employee> employees;
private List<Department> departments;
public void init()
{
//Do initialization stuff here
}
public String getAllEmployees(){
employees = empService.getAllEmployees();
return "success";
}
public String deleteEmployee(){
empService.deleteEmployee(employee.getEmployeeId());
return "success";
}
}
Run Code Online (Sandbox Code Playgroud)
现在,在上面的代码时Struts动作getAllEmployees()
和deleteEmplyee()
被称为我想init()
方法首先执行.我们可以通过从两个函数调用它来运行它.
但是struts 2中是否有任何规定会在每次调用时自动运行init方法,或者struts 2为action clases提供任何此类方法?
如果有人知道,请告诉我.
谢谢.
我正在使用zkoss 5.0.4,Spring 3.0.3,Hibernate 3和JpA 1.0以及JBOSS 5.1 GA(支持JDK)创建Web应用程序.
该项目与JBOSS编译良好.但似乎由于某些原因而不适用于持久性.
当我在控制台中运行应用程序时,它显示以下内容:
10:07:35,265 WARN [QuerySplitter] no persistent classes found for query class: from org.zkforge.zktodo2.Reminder
Run Code Online (Sandbox Code Playgroud)
以下是我在/WEB-INF/lib
目录中使用的jar文件列表.
aopalliance.jar
asm-1.5.3.jar
asm-attrs-1.5.3.jar
cglib-2.1_3.jar
commons-dbcp-1.2.2.jar
commons-fileupload-1.2.1.jar
commons-io.jar
commons-pool-1.3.jar
ehcache-1.2.3.jar
fckez.jar
groovy.jar
jruby.jar
js.jar
junit-3.8.1.jar
jython.jar
org.springframework.aop-3.0.3.RELEASE.jar
org.springframework.asm-3.0.3.RELEASE.jar
org.springframework.aspects-3.0.3.RELEASE.jar
org.springframework.beans-3.0.3.RELEASE.jar
org.springframework.context.support-3.0.3.RELEASE.jar
org.springframework.context-3.0.3.RELEASE.jar
org.springframework.core-3.0.3.RELEASE.jar
org.springframework.expression-3.0.3.RELEASE.jar
org.springframework.instrument.tomcat-3.0.3.RELEASE.jar
org.springframework.instrument-3.0.3.RELEASE.jar
org.springframework.jdbc-3.0.3.RELEASE.jar
org.springframework.jms-3.0.3.RELEASE.jar
org.springframework.orm-3.0.3.RELEASE.jar
org.springframework.oxm-3.0.3.RELEASE.jar
org.springframework.test-3.0.3.RELEASE.jar
org.springframework.transaction-3.0.3.RELEASE.jar
org.springframework.web.portlet-3.0.3.RELEASE.jar
org.springframework.web.servlet-3.0.3.RELEASE.jar
org.springframework.web.struts-3.0.3.RELEASE.jar
org.springframework.web-3.0.3.RELEASE.jar
zcommon.jar
zcommons-el.jar
zhtml.jar
zk.jar
zkplus.jar
zul.jar
zweb.jar
Run Code Online (Sandbox Code Playgroud)
以下是我的web.xml
档案:
<?xml version="1.0" encoding="UTF-8"?>
< web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" …
Run Code Online (Sandbox Code Playgroud) 我正在使用SPRING 3.0.4,JPA 2,Hibernate 3.5.5开发应用程序.
我正在尝试在链接http://www.javacodegeeks.com/2010/05/jboss-42x-spring-3-jpa-hibernate.html上给出的现有示例.
唯一的区别是我使用的是最新版本的库和JBOSS服务器.
以下是我的/ WEB-INF/lib目录文件的列表
ANTLR-2.7.6.jar
aopalliance.jar
c3p0-0.9.1.jar
公地集合-3.1.jar
共享记录-1.1.1.jar
dom4j的-1.6.1.jar
GWT-dev.jar
GWT-user.jar
hibernate.jar文件
冬眠-JPA-2.0-API-1.0.0.Final.jar
的hsqldb.jar
Javassist进行-3.9.0.GA.jar
JTA-1.1.jar
log4j的-1.2.16.jar
org.springframework.aop-3.0.4.RELEASE.jar
org.springframework.asm-3.0.4.RELEASE.jar
org.springframework.aspects-3.0.4.RELEASE.jar
org.springframework.beans-3.0.4.RELEASE.jar
org.springframework.context.support-3.0.4.RELEASE.jar
org.springframework.context-3.0.4.RELEASE.jar
org.springframework.core-3.0.4.RELEASE.jar
org.springframework.expression-3.0.4.RELEASE.jar
org.springframework.instrument.tomcat-3.0.4.RELEASE.jar
org.springframework.instrument-3.0.4.RELEASE.jar
org.springframework.jdbc-3.0.4.RELEASE.jar
org.springframework.jms-3.0.4.RELEASE.jar
org.springframework.orm-3.0.4.RELEASE.jar
org.springframework.oxm-3.0.4.RELEASE.jar
org.springframework.test-3.0.4.RELEASE.jar
org.springframework.transaction-3.0.4.RELEASE.jar
org.springframework.web.portlet-3.0.4.RELEASE.jar
org.springframework.web.servlet-3.0.4.RELEASE.jar
org.springframework.web.struts-3.0.4.RELEASE.jar
org.springframework.web-3.0.4.RELEASE.jar
SLF4J-API-1.5.8.jar
SLF4J-log4j12-1.6.1.jar
spring4gwt-0.0.1.jar
以下是我的/WEB-INF/web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
Run Code Online (Sandbox Code Playgroud)
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Servlets -->
<servlet>
<servlet-name>springGwtRemoteServiceServlet</servlet-name>
<servlet-class>org.spring4gwt.server.SpringGwtRemoteServiceServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>springGwtRemoteServiceServlet</servlet-name>
<url-pattern>/gwtspring/springGwtServices/*</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>GWTSpring.html</welcome-file>
</welcome-file-list>
Run Code Online (Sandbox Code Playgroud)
以下是我的/WEB-INF/applicationContext.xml文件
<beans xmlns="http://www.springframework.org/schema/beans" …
Run Code Online (Sandbox Code Playgroud) 我想将 Dojo 的 Dijit Dialog 相对于我的 html 元素之一定位。是否可以?如果是。如何?
目前它总是在视口中间显示对话框。
任何人都可以帮助我解决此事吗?
谢谢。
阿玛尔4金图
我正在使用oracle 11g,Java(struts2)和Hibernate开发应用程序.
我有一个名为mytemp的表,列为mytemp_id,类型为NUMBER(22,0).
在我的mytemp.hbm.xml文件中,id如下所示
<id name="mytempId" type="big_decimal">
<column name="MYTEMP_ID" precision="22" scale="0" />
<generator class="sequence">
<param name="sequence">MYTEMP_TEMP_ID_SEQ</param>
</generator>
</id>
Run Code Online (Sandbox Code Playgroud)
在我的Oracle数据库中创建名为"MYTEMP_TEMP_ID_SEQ"的序列,并在Oracle中正常工作.
现在当我尝试使用hibernate插入记录时,它会给我以下错误
org.hibernate.id.IdentifierGenerationException:此id生成器生成long,integer,short或string
看来,我的顺序返回号码,hibenate考虑它作为BigDecimal的,而休眠的sequece发电机类考虑到长值,整数,短,只字符串.
Hibernate应该没有BigDecimal的问题.但我认为他们没有为序列生成器实现BigDecimal
任何人都可以帮我解决问题吗?
谢谢.