数据库常见的join方式有三种:inner join, left outter join, right outter join(还有一种full join,因不常用,本文不讨论)。这三种连接方式都是将两个以上的表通过on条件语句,拼成一个大表。以下是它们的共同点:
1. 关于左右表的概念。左表指的是在SQL语句中排在left join左边的表,右表指的是排在left join右边的表。
2. 在拼成的大表中,左表排在左边,右表排在右边。
3. on条件语句最好用=号对两表相应的主外键进行连接。当然,也可以用其他操作符,如>, <, 来连接两表的任一字段,此时的关系将非常复杂,连接后的记录数也随之而变得不确定。如果在一些特殊的场合中需要用到这种方式,必须通过简单的实例加以确认,否则,连接结果很可能不是我们所想要的!
4. on条件语句不能省略。
5. 可以连锁使用join,每次使用join都令另一表与当前的表或连接的结果相连接。
在下文中,用到了两个表,"部门"表与"组织"表,其中,"部门"表有一名为"组织编号"的外键,指向"组织"表中的主键"编号"。
inner join
格式:select * from 部门 inner join 组织 on 部门.组织编号 = 组织.编号
目的:将两表中符合on条件的所有记录都找出来。
规律:
1. 拼出的大表记录不会增加。
2. 如果左边与右表的关系是一对多的关系,在选出的任一记录中,假若右表有多个记录与其对应,那么,连接后的左表,主键将不再唯一。
典型应用:将存在多关系的引用表放在左表,将存在一关系的被引用表放在右表,通过=号将主外键进行连接,通过对右表设定过滤条件,选出相应的且主键唯一的左表记录。
备注:inner join 是默认的连接方式,可缩写为join。
转化为where子句:
select * from 部门, 组织 where 部门.组织编号 = 组织.编号
left outter join
格式: select * from 部门 left join 组织 on 部门.组织编号 = 组织.编号
格式: select * from 组织 left join 部门 on 组织.编号 = 部门.组织编号
目的:将左表的所有记录列出,右表中只要符合on条件的,与左表记录相拼合,不符合条件的,填以null值。
规律:
1. 选出所有符合条件的左表,如果左边与右表的关系是一对一的关系,则拼成的大表记录不会改变。
如果左边与右表的关系是多对一的关系,则拼成的大表记录也不会改变。
如果左边与右表的关系是一对多的关系,则拼成的大表记录会增加。对于每一具有一对多关系的左表记录,如果左表1:N与右表对应,那么会多出N-1条记录。例如,如果左表第一条记录1:3对应于右表,多出2条记录。如果左表第二条记录1:2对应于右表,则再多出1条记录。这样,总共多出3条记录。其他类推。
2. 如果左边与右表的关系是一对多的关系,在选出的任一记录中,假若右表有多个记录与其对应,那么,连接后的左表,主键将不再唯一。
3. 如果左边与右表的关系是一对多的关系,对于左表任一记录,如果右表没有记录与其相对应,则全部填以null值。
典型应用:将存在多关系的引用表放在左表,将存在一关系的被引用表放在右表,通过对右表设定过滤条件,选出相应的且主键唯一的左表记录。
备注:left outter join可用left join代替。在有些数据库中,如HSqlDb, 只能使用left join而不能使用left outter join。
转化为where子句:
select * from 部门, 组织 where 部门.组织编号 = 组织.编号
right outter join
格式: select * from 部门 right join 组织 on 部门.组织编号 = 组织.编号
格式: select * from 组织 right join 部门 on 部门.组织编号 = 组织.编号
目的:将右表的所有记录列出,左表中只要符合on条件的,与右表记录相拼合,不符合条件的,填以null值。
规律:(与left outter join相反)
典型应用:可转化成left outter join。例如
select * from 组织 right join 部门 on 部门.组织编号 = 组织.编号
与
select * from 部门 left join 组织 on 部门.组织编号 = 组织.编号
的效果一样
备注:right outter join可用right join代替。在有些数据库中,如HSqlDb, 没有实现right join功能。
转化为where子句:
select * from 部门, 组织 where 部门.组织编号 = 组织.编号
Session Descriptions
You've heard everyone praising the benefits of test-driven development, and you'd really like to try it yourself, but how do you get started on a real project? This talk gives you 12 practical ways to start writing tests, and keep writing them, regardless of your project's technology or development process. You'll be able to immediately apply these no-nonsense techniques toward improving your design and testing skills. In no time you'll be writing better software, and faster!
Advanced Agile Techniques: Beyond XP
Scott Ambler
Many development teams have adopted some, if not all, of the techniques of Extreme Programming (XP). There is far more to agile software development, however, than XP. In this presentation you'll learn advanced techniques such as initial architectural modeling, database refactoring, model storming, and agile documentation practices (yes, you still have to write documentation).
Advanced Analytic Applications with Java Data Mining
Mark Hornick
Building applications without advanced analytics is becoming a dangerous practice. Applications that merely collect and report data using queries or OLAP will soon give way to competitor applications that enlist the help of advanced analytics capabilities such as data mining. The Java Data Mining standard (JSR-73) enables building advanced analytic applications natively in Java.
In this session, Mark highlights an application involving campaign management – selecting customers for a product promotion. Response modeling involves identifying which customers are likely to respond to the promotion. First, Mark explores a solution without the use of data mining, then illustrate how that same application can be augmented with data mining technology to improve the response rate as well as the profitability of the campaign. Mark also provides an overview of JDM 1.0 (JSR-73) and the upcoming JDM 2.0 (JSR-247) standards and how these can be used to build such applications.
Advanced Testing Techniques with TestNG
Cedric Beust
TestNG is a recent testing framework built on annotations that offers advanced testing functionalities such as test groups, method parameters, dependent methods and time-outs. This presentation will offer a short introduction to TestNG and then will discuss some testing scenarios typically encountered by programmers in various software areas and how TestNG can help create elegant and simple testing designs.
AOP in the Enterprise
Adrian Colyer
In this session Adrian will describe how and why you should be using AOP within your enterprise applications. You will gain a deeper understanding of the goals of AOP, and the different ways that AOP frameworks realize those goals. Spring AOP and AspectJ 5 will then be introduced, and their complementary roles within enterprise applications explained. Recommendations and a roadmap for getting started with these technologies will be presented (with examples and demos) so that you can begin applying what you learn during the talk straight away.
Apache Geronimo Prime-time
Jeff Genender
Apache Geronimo is the latest open source application server to achieve J2EE 1.4 certification, making it ready for prime time in the Enterprise. It is now a real contender in the open source application server market and offers a unique architecture making different open-source projects pluggable and capable of building customized stacks. This session will present an overview of Apache Geronimo, its architecture, its major open source components, how it works, and how to configure and use the application server. This session will cover Geronimo's different concepts such as the kernel, GBeans, deployment and different configurations, and running the application server.
Beyond Java: Technologies to Watch
Bruce Tate
Recently, we've seen a flurry of innovation happen in dynamic languages. From the Ruby on Rails framework to continuation servers to Erlang, a language based on concurrency, we've seen incredible innovation over the last two years. Many of these ideas are just now showing up on the Java platform in frameworks like Rife, Seam and Spring Web Flow.
"Bottom 10" Reasons Agile Teams Fail
Clinton Begin
Agile methodologies such as eXtreme Programming and SCRUM are hot topics today -- and they are also hot targets. When things go wrong on an agile project, it's far too convenient to blame the methodology. Consequently it's often the case that the methodology is blamed, instead of the people charged with implementing it correctly. In this talk Clinton will discuss the most common reasons a team may fail when trying to execute a project using an agile methodology. He'll cover how to learn from the mistakes of others, and avoid repeating new mistakes of your own.
Building Identity Management Solutions
Justen Stepka
Application developers are with what seems to be an unlimited number of approaches to integrating identity management and single sign-on(SSO).
This presentation will focus on the existing solutions that are available, commerical and open-source and examples from each to help you understand what solution might best work for you. Best practices and lessons learned from popular approaches will be covered too.
Building Quality Applications with Ajax
Dion Almaer & Justin Gehtland
Ajax has revolutionized Web application development in the short year since the term was coined. What is it all about? Why are we excited about a set of capabilities that have been sitting in our browser for years? What can you do with it? And, how can you do it?
Ajax , short for Asynchronous JavaScript and XML, is a technique for communicating with servers from within a web page without causing a page refresh.
This session provides:
- An introduction to Ajax and an orientation to the state of the ajaxian universe
- A demonstration of the basic ajaxian techniques through live coding. More advanced examples of Ajax will be demonstrated and deconstructed
You will understand:
- How the Google Maps UI is built (and why it isn't as hard as it looks)
- How Ajax can improve portals, community sites, and pretty much any other type of web application.
Furthermore, the issues surrounding how to create an Ajax application that doesn't turn into an unmaintainable pile of hacked up crap JavaScript will be discussed.
This talk will be presented by the founders of Ajaxian.com, a popular Ajax-related web portal.
Building Quality Applications with Ajax Frameworks
Dion Almaer & Justin Gehtland
Ajax techniques can lend tremendous richness to your Web UIs. But Ajax can be tedious and difficult to implement from scratch. Fortunately, there are a number of powerful frameworks that can make it much easier to do Ajax, including some that integrate with Java-based Web frameworks.
This session demonstrates (through live coding):
- The popular Prototype, Dojo, MochiKit, DWR and Scriptaculous frameworks, each of which offers unique abilities to enhance your applications. These frameworks can be used with any server-side framework
- Their use with Struts and JavaServer Faces applications
This talk will also discuss the state of Ajax support for JavaServer Faces via third-party JSF components and JSF-specific frameworks.
You will understand:
- How to easily add amazing Ajax effects to your Java-based Web application.
Distributed Caching: Essential Lessons
Cameron Purdy
This presentation covers application development considerations for achieving maximum scalable performance and reliability in clustered J2EE environments, improving scalability and scalable performance of applications through the use of clustered caching to reliably share live data among clustered JVMs in the application tier, providing transparent fail-over as a key element of uninterrupted operation, and reduced load on the database tier as a key element of scalability.
Dive into RIFE
Geert Bevin
RIFE is a full-stack, open-source Java web application framework, offering fast results with the promise of maintainability and code clarity. This presentation gives you an exclusive insight into its goals and underlying ideas. Through some practical examples, the most important modules are introduced and you'll understand that it's very easy to quickly cover a great distance.
Essential EJB 3.0 Persistence
Doug Clarke
A crash course introduction to EJB 3.0 Persistence of Java Enterprise Edition 5.0. The goal of this session is to demonstrate how to apply the EJB 3.0 Persistence functionality in enterprise application development. Attendees will leave with enough information to get them started building enterprise applications using this new standard. The material will be presented using live demos of application development, testing, and deployment. The persistence capabilities both within and outside of an EJB container will be highlighted.
The open source reference implementation of the EJB 3.0 Persistence, TopLink Essentials, will be used in conjunction with the Eclipse Dali EJB ORM Project tools to build an end to end application illustrating common patterns and best practices.
Extreme Web Caching
Jason Hunter
Web Caching is very important for high traffic, high performance web site but few people know all the professional-level strategies. In this talk I'll share some of the tricks of the trade, including advanced tips from Yahoo's Mike Radwin.
We'll start with the basics: using client-side caches, conditional get, and proxies. Then we'll talk about more advanced features: how best to handle personalized content, setting up an image caching server, using a cookie-free domain for static content, and using randomization in URLs for accurate hit metering or sensitive content.
Attendees should have experience or interest in how the web works and in cajoling the web into doing their bidding.
FastSOA: Applying Native XML Database Technology To Improve SOA Performance
Frank Cohen
The choices Web Service architects and developers make on XML handling libraries, XML message encoding styles and binding utilities, and XML schema design and complexity, have a great impact on the scalability and performance of the deployed service. In this presentation, Frank Cohen will show the results of a recently completed research project that show the performance characteristics of three representative use case implementations on a variety of application servers, both commercial and open-source. Cohen will describe the developer learning curve and productivity story encountered when building the implementations with a wide variety of tools. Cohen will give attendees a kit of the software, a performance test, and developer guide book to use in your own environment.
Flow with Continuations
Geert Bevin
Get back in control of the natural flow of your application.
Continuations leverage the expressiveness of Java for the creation of re-enterable execution points. This presentation explains what continuations are and why they are useful. The benefits quickly become apparent through side-by-side comparisons with traditional flow management. You'll get an overview of the different approaches of today's tools and will see that continuations are handy in many application domains.
Java Specialists in Action
Dr. Heinz Kabutz
Java has some features that make it highly flexible to work with, like putty in the hands of a craftsman. Java specialists are not shy to use advanced features like dynamic proxies, generics, enums to their advantage. In this talk, we will demonstrate some approaches of using Java's dynamic proxies to create virtual proxies, protection proxies, dynamic object adapters and dynamic decorators. A part of the talk will also explore the performance implications and compare it with the benefits gained. P.S. If you are wondering why “enum” is listed under “advanced features” you should definitely attend this talk.
JCR vs. RDBMS: Your App. is a "Content App.", 10 symptoms!
In many applications the typical short-comings of relational databases are covered up either by using database centric frameworks or even worse by using secondary storage. This shows in symptoms that we all know: Binaries go into a Filesystem, "unstructured" information is stored in XML, etc...
This session is geared to prove that a JCR compliant content repository is the ideal general purpose "Future Storage" for modern Applications that require commodity features like Versioning, Fulltext search, Hierarchy support, Ranking, Namespaces without sacrificing transactions, referencial integrity and scalability.
Expect real-life examples and code-snippets.
The Mobile Java Application Continuum
J Mobile Java has historically being confined to games and trivial applications for personal and mobile devices. Failure or reluctance on behalf of the manufacturers and carriers to implement a full range of services has prevented the wide adoption of the technology for robust applications. This presentation introduces an execution architecture for rich mobile Java applications and for interacting with e-commerce or enterprise systems. Robust mobile application design requires coordination with multiple tiers of resources and overcoming the limitations of J2ME/CLDC and the current crop of JSR implementations. This presentation will teach you how to design and implement a Java mobile application that operates in a seamless continuum from the handset device to your data warehouse and with third-party service providers.
Open Source SOA Using POJOs
James Strachan
This session will provide an overview of how folks should develop SOA applications so they can take advantage of various middleware technologies like JMS, RMI, WS, JBI, BPEL etc yet keep their code simple and POJO like and to deal with things like asynchronous messaging, ESBs and so forth showing examples using different Apache tools and frameworks.
OSWorkflow
OSWorkflow is a workflow engine from the OpenSymphony group. The talk will be an introduction of the osworkflow engine, a brief discussion of its architecture, as well as highlighting use cases and illustrating integration and usage patterns.
Patterns in Service-Oriented Architectures
If this was buzzword bingo I probably would be an instant winner with this session title. Nevertheless, patterns and service-oriented architectures do have very interesting and relevant intersection points. Both terms are fashionable, somewhat blurry and often abused. Both terms are also very much about architecture and design trade-offs – the softer side of software development. Despite all the hype, SOA brings alternative architecture styles and programming models into the mainstream. We now write software using process engines, asynchronous message flow, rules engines, transformations etc. Each style comes with a collection of patterns that should be recognized and documented so that we can build effective solutions and discuss design trade-offs outside of specific technology choices and implementations.
Persistence with iBATIS - Hands On
Clinton Begin
A wise man once said: "PowerPoint is the worst thing ever to happen to public speaking." So, in this session, Clinton will use only a Java IDE and real-world examples to demonstrate how iBATIS is used to create an effective persistence layer for your application. He will risk life and limb (or at least his reputation) coding before an audience, to build the back end of a simple Java application using a Test Driven approach. No code snippets here, the persistence layer will be coded from scratch -- with no safety net!
Portlet Development with JSF
Component-oriented user interface frameworks such as JavaServer Faces (JSF) are growing in popularity, and organizations are also beginning to recognize the power of building application components with the Portlet API. What many don't realize, however, is the fact that JSF has integrated support for the Portlet API, making it a natural fit for building portlets. This session starts with a brief overview of JSF, portlets, and portals. It then explains how JSF portlet support works, and examines the process of developing portlets with JSF. Next, it walks through the development of a simple JSF application and deployment of that application as a portlet inside of Liferay Enterprise Portal, an open-source portal server.
Productive Coder
Code Java at the speed of light. Modern IDEs have revolutionised the way in which we are able to churn out code. But sadly, most programmers are held back by bad habits and so never fully utilise the power that is at their fingertips. This talk will demonstrate practical tips on how to go from 2nd gear to overdrive. Topics range from keyboard skills to writing useful comments to refactoring quickly and correctly. Keywords such as final, which is not so final anymore in Java 5, and tools to help you detect dead and duplicate code. Have more fun in your day-to-day Java work by becoming one with your machine.
RAD That Ain't Bad: Domain Driven Development with Trails
Chris Nelson
The Trails framework aims to take a new approach to Rapid Application Development in Java using proven frameworks like Spring, Tapestry, and Hibernate. By eliminating redundant steps in the development process and stressing convention over configuration, Trail can greatly accelerate development of RDBMS persistent web applications. In this session, we'll build a real Trails application in a few minutes, and then dive into the details of how Trails works and how to customize it to your heart's content. We'll also cover how Trails provides features you need to build real application such as validation, internationalization, and security.
Refactoring Databases: Evolutionary Database Design
Scott Ambler
Just like you can refactor your Java code, you can also refactor your database schema. Unfortunately, it's about an order of magnitude tougher to do, in part because of the increased coupling which your schema is involved with, in part because of a lack of tooling, and in part because of cultural challenges within the data community (and that's the nice way to say it). In this presentation you'll learn how to successfully overcome these challenges and discover how to take an agile approach to database development.
Shale: The Next Struts?
The standardization of JavaServer Faces has led to support for this technology in existing web application frameworks. However, most of them treat it as a view tier technology only. Shale, on the other hand, leverages the fact that JavaServer Faces includes a controller tier as well, and focuses on adding value and ease of use features, rather than redundantly implementing functionality that is already available. This session will review the key features added by Shale, as well as its place in the Struts community.
Software Visualization and Model Generation
Models are often viewed as something you create during design time and use to generate code. What if we turn the approach up-side-down and generate models from code? Humans are very good at recognizing patterns in images, making visualizations a valuable tool, for example to recognize dependencies or data flow. This is particularly true for dynamic, loosely coupled systems that are often less explicit and evolve over time. Once you have generated a model you can take things a step further and run checks and validations against it. Visualizations can also be used to plot out source code metrics over various dimensions to detect potential “hot spots” in the application that may require special attention.
This talk applies the concepts of visualization and model generation to a broad range of usage scenarios, such as asynchronous messaging, software components and object-oriented applications.
The State of Web Frameworks
The last couple of years have seen a burst of both standardization and increased innovation in web application frameworks, to say nothing of the very quick uptake in popularity of AJAX. What does it mean for choosing server side technology? What does AJAX mean to existing frameworks? Should we all go back to rich clients instead? Come to this session for a high level overview of the present, and future, of building rich applications for the web.
Using Java Business Integration to Enable Composite Applications with ServiceMix
Bruce Snyder
Java Business Integration (JBI) is a simple API to a Normalized Message Service and Router along with a component model to facilitate the deployment and management of integration services. ServiceMix is a leading open source Enterprise Service Bus (ESB) and Service Oriented Architecture (SOA) toolkit based on the Java Business Integration
(JBI) specification. ServiceMix provides business integration capabilities using a complete JBI container and a host of JBI components including those for orchestration, rules, scheduling, transformation, validation and JBI transports including those for email, file, FTP, HTTP, JMS, RSS, VFS, VM and many more.
This session will focus on using ServiceMix in a composite application scenario that takes advantage of its JBI implementation and its use of other Java Enterprise Edition specifications.
Using the Apache License, not only can ServiceMix be deployed in a standalone configuration, but it is also fully integrated with Apache Geronimo or any other J2EE 1.4 compliant application server via the J2EE Connector Architecture (JCA). Fully embracing the Java Message Service (JMS) and Web Services standards allows ServiceMix to provide reliable and robust message delivery regardless of the message payload. The ServiceMix SOA platform provides for the managment of its JBI components via the Java Management eXtensions (JMX) using any JMX compliant management console.
XQuery for the Java Geek
Jason Hunter
XQuery is a new language from the W3C that lets you query XML -- or anything that can be represented as XML, such as relational databases.
As a Java developer -- especially a server-side Java developer -- XQuery is key to searching and manipulating large XML repositories or performing any XML-centric task.
This talk introduces XQuery to the Java developer. I'll explain the XQuery language; I'll show how to call XQuery from Java (including coverage of JSR-225, the XQuery API for Java); and I'll show the XQuery and Java code behind a sample custom book publishing application.
As the creator of JDOM, I'll also explain when to use XQuery instead of JDOM, and when to use both.
XML, Schemas and Performance
Frank Cohen
The IT world is dealing with an explosion of XML schemas and the average Java engineer is not prepared with today's XML tools and techniques. For instance, SOAP, RSS, REST, SOA schemas and protocols, and AJAX are challenging developers every day. In this session Frank Cohen will give many examples of XML schema incompatibility, inefficient and needlessly bulky code, and poor performance and scalability that come with popular XML handling libraries, tools, and techniques. Cohen will show how new strategies for on-the-fly data schema transformation, SOA metadata persistence and versioning and policy-driven intelligent data caching are viable solutions.
BOFs
The Importance of Preserving Object Identity while Clustering
Jonas Bonér and Patrick Calahan, Terracotta
Clustering and other forms of distributed computing are not easy in Java. The proliferation of clustered caches in the market today illustrates the need for tools to make clustering in Java easier. The problems with most current solutions are that they break Java's natural programming model – with unnatural API's and breaking fundamental object identity. This Birds of a Feather session will focus on the importance of preserving object identity in a cluster, and will illustrate a runtime system that understands the developer's domain objects and clusters objects across a cluster transparently while maintaining object identity, using detailed code examples to illustrate the concepts.