??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
2006-1-1
2006-1-2
2006-10-1
2006-10-2
2006-5-1
ҎA表中的数据写一条sql语句查询出如下结?
today nextday
2006-1-1 2006-1-2
2006-10-1 2006-10-2
单的题目都把我难倒,痛苦。。?br />下面是QQ朋友帮我想的办法Q?br />解决办法Q?。select a.today as today ,b.today as nextdate from A a join A b on b.today -a.today =1
2。select a.today,b.today as nextdate from A a,A b where a.today=b.today-1
]]>
1 100
2 200
main?br />id test_id salary
1 1 Null
2 1 Null
3 2 Null
Ltest表中的salary更新main表中的salary
看到q题目让我傻了,q么单的题目Q可我就是不会?/p>
下面是我回来后重新查帮助后才解决的。测试数据如下,
create table test(
id int primary key identity(1,1),
salary int
)
go
insert into test(salary) values(100)
insert into test(salary) values(200)
go
create table main(
id int primary key identity(1,1),
test_id int references test(id),
salary int
)
go
insert into main(test_id) values(1)
insert into main(test_id) values(2)
go
{案Q?br />UPDATE main
SET main.salary = test.salary
FROM main INNER JOIN test ON (test.id =main.test_id)
ȝQupdate q可以和 from 一LQ自q的是孤陋寡闻?/p>
lazy=true 一句查?有getPicture()
Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?
lazy=true 一句查询?有getPicture() q且讉K了里面的元数Picture 且有异常抛出
Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?
lazy="false" 两句查询 肯定没问题,因ؓ全部数据都个查了出来 所以怎么调用都正?br />Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?
Hibernate: select pictures0_.photosid as photosid1_, pictures0_.id as id1_, pictures0_.id as id2_0_, pictures0_.photosid as photosid2_0_, pictures0_.name as name2_0_, pictures0_.clicked as clicked2_0_, pictures0_.uploaddate as uploaddate2_0_, pictures0_.size as size2_0_, pictures0_.description as descript7_2_0_, pictures0_.uri as uri2_0_ from super.picture pictures0_ where pictures0_.photosid=?
fetch="join" 一句查询?效果 Q= lazy="false" 呵呵Q哪个效率高Q我׃知道了。。。。。。。。。。?br />Hibernate: select photos0_.id as id0_1_, photos0_.userid as userid0_1_, photos0_.typeid as typeid0_1_, photos0_.name as name0_1_, photos0_.createtime as createtime0_1_, photos0_.description as descript6_0_1_, photos0_.faceid as faceid0_1_, photos0_.uri as uri0_1_, pictures1_.photosid as photosid3_, pictures1_.id as id3_, pictures1_.id as id2_0_, pictures1_.photosid as photosid2_0_, pictures1_.name as name2_0_, pictures1_.clicked as clicked2_0_, pictures1_.uploaddate as uploaddate2_0_, pictures1_.size as size2_0_, pictures1_.description as descript7_2_0_, pictures1_.uri as uri2_0_ from super.photos photos0_ left outer join super.picture pictures1_ on photos0_.id=pictures1_.photosid where photos0_.id=?
不加fetchQ?join" 一句查询?没有getPicture() 正常
Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?
不加fetchQ?join" 一句查询?有getPicture() 正常
Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?
不加fetchQ?join" 一句查?有getPicture() q且讉K里面的元素Picture的ID 有异常抛?br />Hibernate: select photos0_.id as id0_0_, photos0_.userid as userid0_0_, photos0_.typeid as typeid0_0_, photos0_.name as name0_0_, photos0_.createtime as createtime0_0_, photos0_.description as descript6_0_0_, photos0_.faceid as faceid0_0_, photos0_.uri as uri0_0_ from super.photos photos0_ where photos0_.id=?
来个两兵交战 fetch="join" lazy="true" 呵呵 l果Q一句查询, l构正常 所以就当lazy不存在好了?看来fetch 是老大。、、、、、、、、、、、、?br />Hibernate: select photos0_.id as id0_1_, photos0_.userid as userid0_1_, photos0_.typeid as typeid0_1_, photos0_.name as name0_1_, photos0_.createtime as createtime0_1_, photos0_.description as descript6_0_1_, photos0_.faceid as faceid0_1_, photos0_.uri as uri0_1_, pictures1_.photosid as photosid3_, pictures1_.id as id3_, pictures1_.id as id2_0_, pictures1_.photosid as photosid2_0_, pictures1_.name as name2_0_, pictures1_.clicked as clicked2_0_, pictures1_.uploaddate as uploaddate2_0_, pictures1_.size as size2_0_, pictures1_.description as descript7_2_0_, pictures1_.uri as uri2_0_ from super.photos photos0_ left outer join super.picture pictures1_ on photos0_.id=pictures1_.photosid where photos0_.id=?
<iframe width="145" height="130" border="0" align="center" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" src="<br><br><br><br>
<iframe ALIGN='center' src="<br><br><br><br>
<IFRAME ID='ifm1' WIDTH='405' HEIGHT='332' ALIGN='center' MARGINWIDTH='0' MARGINHEIGHT='0' HSPACE='0' VSPACE='0' FRAMEBORDER='0' SCROLLING='NO' SRC=">
<br><br><br>
<iframe width=160 height=230 frameborder=0 ALIGN='center' scrolling=NO src=http://appnews.qq.com/cgi-bin/news_qq_search?city=q州></iframe>
<br><br><br>
<iframe width="469" height="218" border="0" align="center" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" src="<br><br>
<IFRAME ID='ifm1' WIDTH='260' HEIGHT='70' ALIGN='CENTER' MARGINWIDTH='0' MARGINHEIGHT='0' HSPACE='0' VSPACE='0' FRAMEBORDER='0' SCROLLING='NO' src=">
效果如下Q?br />
Summary
JasperReports, a popular, full-featured open source report-generating library, uses XML report templates to generate reports you can display on the screen, send to a printer, or save as a PDF document. In this inaugural Open Source Profile column, Erik Swenson introduces the JasperReports library and explains how to integrate JasperReports into your applications. (900 words;September 20, 2002)
JasperReports provides the necessary features to generate dynamic reports, including data retrieval using JDBC (Java Database Connectivity), as well as support for parameters, expressions, variables, and groups. JasperReports also includes advanced features, such as custom data sources, scriptlets, and subreports. All in all, JasperReports combines good features, maturity, community participation, and, best of all, it's free.
This article kicks off JavaWorld's new Open Source Profile column dedicated to Java-based open source tools and components. Look for upcoming articles spotlighting the Echo Web application framework and ObJectRelationalBridge, an object/relational mapping tool. Feel free to send me your suggestions for future articles.
Note: The documentation and code featured in this article are based on JasperReports version 0.3.3.
Report design <?xml version="1.0" encoding="UTF-8"?> The template's beginning includes any parameters passed into the report, the query that retrieves the data for the report, and the fields displayed in the report. The template's remainder divides into six report sections:
enerating reports is a common, if not always glamorous, task for programmers. In the past, report generation has largely been the domain of large commercial products such as Crystal Reports. Today, the open source JasperReports report generating library gives Java developers a viable alternative to commercial software.
In JasperReports, you design reports using XML report templates. For example, the following XML file is a template for a report with a title, two columns of data, and page numbers:
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="BasicReport" >
<parameter name="Title" class="java.lang.String"/>
<queryString><![CDATA[select name, cost from product]]></queryString>
<field name="NAME" class="java.lang.String"/>
<field name="COST" class="java.lang.Double"/>
<title>
<band height="50">
<textField>
<reportElement x="0" y="0" width="200" height="50" />
<textFieldExpression class="java.lang.String">$P{Title}</textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band>
</band>
</pageHeader>
<columnHeader>
<band height="20">
<staticText>
<reportElement x="180" y="0" width="180" height="20"/>
<textElement>
<font isUnderline="true"/>
</textElement>
<text><![CDATA[NAME]]></text>
</staticText>
<staticText>
<reportElement x="360" y="0" width="180" height="20"/>
<textElement>
<font isUnderline="true"/>
</textElement>
<text><![CDATA[COST]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20">
<textField>
<reportElement x="180" y="0" width="180" height="20"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{NAME}]]></textFieldExpression>
</textField>
<textField pattern="0.00">
<reportElement x="360" y="0" width="180" height="20"/>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{COST}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band>
</band>
</columnFooter>
<pageFooter>
<band height="15">
<staticText>
<reportElement x="0" y="0" width="40" height="15"/>
<textElement/>
<text><![CDATA[Page:]]></text>
</staticText>
<textField>
<reportElement x="40" y="0" width="100" height="15"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band>
</band>
</summary>
</jasperReport>pageHeader
detail
pageFooter
height
. Each band can include multiple textField
elements, which are given a position, size, and value. Report parameters, fields, and variables are referenced using F${name}
, and textField
containing the current page number. The page number's value is set to the variable <textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
The above template represents a basic, yet functional, report. A thorough JasperReports XML-template description is beyond the scope of this article, but I've included numerous links in Resources to tools that will help you edit and create your own report templates. Next, let's see how to use JasperReports in your Java applications.
Use JasperReports
To begin using JasperReports, you first must understand what objects JasperReports uses to represent the reporting process as it progresses from report design to report generation:
JasperDesign
from an XML report template, though you can also create it programmatically.
JasperDesign
. The compilation process verifies the report design and compiles the design into a JasperPrint
: Represents a generated report. You create a JasperReport
through the fill process in which a report is populated with data from a data source.
The JasperReports API's flexibility lets you load JasperReport
, and dori.jasper.engine.JasperManager
, with methods that facilitate loading, compiling, filling, and printing reports. The following code illustrates a JasperReport jasperReport = JasperManager.compileReport(jasperDesign);
// Second, create a map of parameters to pass to the report.
Map parameters = new HashMap();
parameters.put("ReportTitle", "Basic JasperReport");
parameters.put("MaxSalary", new Double(25000.00));
// Third, get a database connection
Connection conn = Database.getConnection();
// Fourth, create JasperPrint using fillReport() method
JasperPrint jasperPrint = JasperManager.fillReport(jasperReport,
parameters, conn);
// You can use JasperPrint to create PDF
JasperManager.printReportToPdfFile(jasperPrint, "BasicReport.pdf");
// Or to view report in the JasperViewer
JasperViewer.viewReport(jasperPrint);
The code example above shows how to perform some common tasks using JasperReports. In a real-world application, you'd find it impractical to load and compile the JasperDesign
files to increase speed. You can also increase a large report's speed by generating and saving Reports the easy way
In this article, you learned how the open source JasperReports can aid your Java reporting needs. If you are building a reporting application or looking to add reporting capability to an existing application, look at JasperReports. Visit the JasperReports homepage for more information and download the latest version.
对jsf目的支持,sun creator 无疑lh一U?耳目一新的感觉Q?br />他对可视化开发的支持真的开始可以和.Net较劲了?/p>
但是 creator 有个问题是可以把项目部|到 sun app server的项目部|到其他服务器老是出同L问题Q?br />
下面ȝ一下:
步骤一: 把项目导出成 *.war文g
步骤? ?.war拯到其他服务器的部|目?br /> 比如 tomcat/resin ?webapp?br />步骤? q行服务?tomcat/resin) 问题来了,出现异常
[10:41:34.828] java.lang.NullPointerException
[10:41:34.828] at javax.faces.webapp.FacesServlet.init(FacesServlet.java:144)
[10:41:34.828] at com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:646)
[10:41:34.828] at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:587)
看到q个"FacesServlet.java:144" 开始我怀疑是sun 的包的问? |上google和baidu了一?没搜到相关问题的解决办法.
最后在一个朋友的帮助下在web.xml文g里加了个Listener:
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
?q真?
心得如下:
在用workshop或者myeclipse用myfaces包徏jsf目?我们不会到cM的问?
因ؓ工具已经在web.xml里面加了listener:
<listener>
<!-- Listener, that does all the startup work (configuration, init). -->
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener </listener-class>
</listener>
但是如果用这些工L sun jsf 包时p手动listerner.(?步骤?
l大家个q接: sun creator的教E?从这里开始学jsf感觉比较全面:
http://gceclub.sun.com.cn/prodtech/javatools/jscreator/learning/tutorials/index.html
insert into topic(title,content) values('title1','content1')
insert into topic(title,content) values('title1','content1')
insert into topic(title,content) values('title1','content1')
insert into topic(title,content) values('title1','content1')
insert into topic(title,content) values('title1','content1')
insert into topic(title,content) values('title1','content1')
insert into topic(title,content) values('title1','content1')
insert into topic(title,content) values('title1','content1')
insert into topic(title,content) values('title1','content1')
insert into topic(title,content) values('title1','content1')
create table review(
id int primary key identity(1,1),
topicid int references topic(id),
content text,
posttime datetime default getdate()
)
insert into review(topicid,content) values(1,'reice1')
insert into review(topicid,content) values(1,'reice1')
insert into review(topicid,content) values(2,'reice1')
insert into review(topicid,content) values(2,'reice1')
insert into review(topicid,content) values(2,'reice1')
insert into review(topicid,content) values(3,'reice1')
insert into review(topicid,content) values(3,'reice1')
insert into review(topicid,content) values(3,'reice1')
insert into review(topicid,content) values(3,'reice1')
insert into review(topicid,content) values(4,'reice1')
select t.id,t.title,t.content,r.newposttime from topic as t inner join (select max(posttime) as newposttime, topicid from review group by topicid) as r on t.id=r.topicid
q些是测试数?sqlserver2000试通过
IT315发表的文档,均来自于相关|站公开发表的内容,如果您认为本站发表的文章늊了您的著作权Q请及时与本站取得联p,本站在W一旉内删除。如果您有好的文章也可以通过Email提供l我们,如果有问题可以在留言板提出?/font> |