You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <one...@us...> - 2003-03-01 06:14:17
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql In directory sc8-pr-cvs1:/tmp/cvs-serv8308/sf/hibernate/sql Modified Files: QueryJoinFragment.java QuerySelect.java Log Message: outer join support in HQL Index: QueryJoinFragment.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql/QueryJoinFragment.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QueryJoinFragment.java 23 Feb 2003 07:22:11 -0000 1.1 --- QueryJoinFragment.java 1 Mar 2003 06:14:10 -0000 1.2 *************** *** 2,5 **** --- 2,6 ---- package net.sf.hibernate.sql; + import net.sf.hibernate.dialect.Dialect; import net.sf.hibernate.util.StringHelper; *************** *** 8,17 **** private StringBuffer afterFrom = new StringBuffer(); private StringBuffer afterWhere = new StringBuffer(); public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, int joinType) { ! ! addCrossJoin(tableName, alias); ! addCondition(alias, fkColumns, pkColumns); ! } --- 9,29 ---- private StringBuffer afterFrom = new StringBuffer(); private StringBuffer afterWhere = new StringBuffer(); + private Dialect dialect; + + public QueryJoinFragment(Dialect dialect) { + this.dialect = dialect; + } public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, int joinType) { ! if (joinType!=INNER_JOIN) { ! //TODO: get right impl for dialect ! JoinFragment jf = dialect.createOuterJoinFragment(); ! jf.addJoin(tableName, alias, fkColumns, pkColumns, joinType); ! addFragment(jf); ! } ! else { ! addCrossJoin(tableName, alias); ! addCondition(alias, fkColumns, pkColumns); ! } } *************** *** 30,34 **** public JoinFragment copy() { ! QueryJoinFragment copy = new QueryJoinFragment(); copy.afterFrom = new StringBuffer( afterFrom.toString() ); copy.afterWhere = new StringBuffer( afterWhere.toString() ); --- 42,46 ---- public JoinFragment copy() { ! QueryJoinFragment copy = new QueryJoinFragment(dialect); copy.afterFrom = new StringBuffer( afterFrom.toString() ); copy.afterWhere = new StringBuffer( afterWhere.toString() ); Index: QuerySelect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql/QuerySelect.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QuerySelect.java 28 Feb 2003 07:01:28 -0000 1.1 --- QuerySelect.java 1 Mar 2003 06:14:10 -0000 1.2 *************** *** 4,11 **** import java.util.Iterator; import net.sf.hibernate.util.StringHelper; public class QuerySelect { ! private JoinFragment joins = new QueryJoinFragment(); private StringBuffer select = new StringBuffer(); private StringBuffer where = new StringBuffer(); --- 4,12 ---- import java.util.Iterator; + import net.sf.hibernate.dialect.Dialect; import net.sf.hibernate.util.StringHelper; public class QuerySelect { ! private JoinFragment joins; private StringBuffer select = new StringBuffer(); private StringBuffer where = new StringBuffer(); *************** *** 42,45 **** --- 43,50 ---- dontSpace.add(StringHelper.OPEN_PAREN); //for MySQL dontSpace.add(StringHelper.CLOSE_PAREN); + } + + public QuerySelect(Dialect dialect) { + joins = new QueryJoinFragment(dialect); } |
From: <one...@us...> - 2003-03-01 06:14:17
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv8308/sf/hibernate/test Modified Files: FooBarTest.java Log Message: outer join support in HQL Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** FooBarTest.java 1 Mar 2003 02:45:27 -0000 1.30 --- FooBarTest.java 1 Mar 2003 06:14:10 -0000 1.31 *************** *** 262,270 **** s.save(bar); ! s.find("select baz.name from Bar bar, bar.baz baz, baz.fooSet foo where baz.name = bar.string"); ! s.find("SELECT baz.name FROM Bar AS bar, bar.baz AS baz, baz.fooSet AS foo WHERE baz.name = bar.string"); ! s.find("select bar.string, foo.string from bar in class Bar, bar.baz as baz, elements(baz.fooSet) as foo where baz.name = 'name'"); ! s.find("select foo from bar in class Bar, bar.baz as baz, baz.fooSet as foo"); assertTrue( s.find("from bar in class Bar, foo in bar.baz.fooSet.elements").size()==0 ); --- 262,284 ---- s.save(bar); ! s.find("select baz.name from Bar bar inner join bar.baz baz inner join baz.fooSet foo where baz.name = bar.string"); ! s.find("SELECT baz.name FROM Bar AS bar INNER JOIN bar.baz AS baz INNER JOIN baz.fooSet AS foo WHERE baz.name = bar.string"); ! //s.find("select baz.name from Bar bar, bar.baz baz, baz.fooSet foo where baz.name = bar.string"); ! //s.find("SELECT baz.name FROM Bar AS bar, bar.baz AS baz, baz.fooSet AS foo WHERE baz.name = bar.string"); ! ! s.find("select baz.name from Bar bar left join bar.baz baz left join baz.fooSet foo where baz.name = bar.string"); ! s.find("select foo.string from Bar bar left join bar.baz.fooSet foo where bar.string = foo.string"); ! ! s.find("select baz.name from Bar bar left join bar.baz baz left join baz.fooArray foo where baz.name = bar.string"); ! s.find("select foo.string from Bar bar left join bar.baz.fooArray foo where bar.string = foo.string"); ! ! s.find("select bar.string, foo.string from bar in class Bar inner join bar.baz as baz inner join elements(baz.fooSet) as foo where baz.name = 'name'"); ! s.find("select foo from bar in class Bar inner join bar.baz as baz inner join baz.fooSet as foo"); ! s.find("select foo from bar in class Bar inner join bar.baz.fooSet as foo"); ! ! //s.find("select bar.string, foo.string from bar in class Bar, bar.baz as baz, elements(baz.fooSet) as foo where baz.name = 'name'"); ! //s.find("select foo from bar in class Bar, bar.baz as baz, baz.fooSet as foo"); ! //s.find("select foo from bar in class Bar, bar.baz.fooSet as foo"); assertTrue( s.find("from bar in class Bar, foo in bar.baz.fooSet.elements").size()==0 ); |
From: <one...@us...> - 2003-03-01 06:14:17
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql In directory sc8-pr-cvs1:/tmp/cvs-serv8308/sf/hibernate/hql Modified Files: FromParser.java PathExpressionParser.java QueryTranslator.java WhereParser.java Log Message: outer join support in HQL Index: FromParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/FromParser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FromParser.java 1 Mar 2003 02:45:26 -0000 1.8 --- FromParser.java 1 Mar 2003 06:14:10 -0000 1.9 *************** *** 2,7 **** --- 2,11 ---- package net.sf.hibernate.hql; + import java.util.HashMap; + import java.util.Map; + import net.sf.hibernate.QueryException; import net.sf.hibernate.persister.Loadable; + import net.sf.hibernate.sql.JoinFragment; import net.sf.hibernate.util.StringHelper; *************** *** 22,26 **** --- 26,42 ---- private boolean expectingIn; private boolean expectingAs; + private boolean afterJoinType; private Loadable classPersister; + private int joinType; + + private static final int NONE = -666; + + private static final Map joinTypes = new HashMap(); + static { + joinTypes.put( "left", new Integer(JoinFragment.LEFT_OUTER_JOIN) ); + joinTypes.put( "right", new Integer(JoinFragment.RIGHT_OUTER_JOIN) ); + joinTypes.put( "full", new Integer(JoinFragment.FULL_JOIN) ); + joinTypes.put( "inner", new Integer(JoinFragment.INNER_JOIN) ); + } public void token(String token, QueryTranslator q) throws QueryException { *************** *** 29,37 **** String lcToken = token.toLowerCase(); if ( lcToken.equals(StringHelper.COMMA) ) { ! if (!expectingJoin) throw new QueryException("unexpected join: " + token); expectingJoin = false; } else if ( lcToken.equals("class") ) { if (!afterIn) throw new QueryException("unexpected token: class"); afterClass=true; } --- 45,64 ---- String lcToken = token.toLowerCase(); if ( lcToken.equals(StringHelper.COMMA) ) { ! if (!expectingJoin) throw new QueryException("unexpected token: ,"); ! expectingJoin = false; ! } ! else if ( lcToken.equals("join") ) { ! if (!afterJoinType) throw new QueryException("unexpected token: join"); ! afterJoinType = false; ! } ! else if ( joinTypes.containsKey(lcToken) ) { ! if (!expectingJoin) throw new QueryException("unexpected token: " + token); ! joinType = ( (Integer) joinTypes.get(lcToken) ).intValue(); ! afterJoinType = true; expectingJoin = false; } else if ( lcToken.equals("class") ) { if (!afterIn) throw new QueryException("unexpected token: class"); + if (joinType!=NONE) throw new QueryException("outer or full join must be followed by path expression"); afterClass=true; } *************** *** 48,54 **** else { ! if (expectingIn || expectingJoin) { // AS is optional ! throw new QueryException("in or join expected: " + token); ! } // now anything that is not a HQL keyword --- 75,81 ---- else { ! if (afterJoinType) throw new QueryException("join expected: " + token); ! if (expectingJoin) throw new QueryException("unexpected token: " + token); ! if (expectingIn) throw new QueryException("in expected: " + token); // now anything that is not a HQL keyword *************** *** 85,88 **** --- 112,117 ---- if (alias==null) throw new QueryException("alias not specified for: " + token); + if (joinType!=NONE) throw new QueryException("outer or full join must be followed by path expression"); + if (afterClass) { // treat it as a classname *************** *** 114,117 **** --- 143,147 ---- if (p!=null) { // starts with the name of a mapped class (new style) + if (joinType!=NONE) throw new QueryException("outer or full join must be followed by path expression"); classPersister = p; expectingAs = true; *************** *** 124,128 **** --- 154,163 ---- } else { + // starts with a path expression (new style) + + if (joinType==NONE) throw new QueryException("path expression must be preceded by full, left, right or inner join"); + /*if (joinType!=NONE) */peParser.setJoinType(joinType); + ParserHelper.parse(peParser, q.unalias(token), ParserHelper.PATH_SEPARATORS, q); if ( peParser.isCollectionValued() ) { *************** *** 133,136 **** --- 168,173 ---- } expectingAs = true; + joinType = NONE; + peParser.setJoinType(JoinFragment.INNER_JOIN); } } *************** *** 149,152 **** --- 186,190 ---- expectingIn = false; expectingAs = false; + joinType = NONE; } Index: PathExpressionParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/PathExpressionParser.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PathExpressionParser.java 28 Feb 2003 07:01:28 -0000 1.9 --- PathExpressionParser.java 1 Mar 2003 06:14:10 -0000 1.10 *************** *** 11,15 **** import net.sf.hibernate.persister.Queryable; import net.sf.hibernate.sql.JoinFragment; - import net.sf.hibernate.sql.QueryJoinFragment; import net.sf.hibernate.type.EntityType; import net.sf.hibernate.type.PersistentCollectionType; --- 11,14 ---- *************** *** 48,60 **** private boolean skippedId; private boolean continuation; ! //private String presetCollectionName; ! ! /*void presetCollectionName(String name) { ! presetCollectionName=name; ! }*/ private void addJoin(String table, String name, String[] rhsCols, QueryTranslator q) throws QueryException { String[] lhsCols = currentColumns(q); ! join.addJoin(table, name, lhsCols, rhsCols, JoinFragment.INNER_JOIN); } --- 47,59 ---- private boolean skippedId; private boolean continuation; ! private int joinType = JoinFragment.INNER_JOIN; //default mode + void setJoinType(int joinType) { + this.joinType = joinType; + } + private void addJoin(String table, String name, String[] rhsCols, QueryTranslator q) throws QueryException { String[] lhsCols = currentColumns(q); ! join.addJoin(table, name, lhsCols, rhsCols, joinType); } *************** *** 65,69 **** q.addType(currentName, clazz); Loadable p = q.getPersister(clazz); ! join.addJoin( p.getTableName(), currentName, joinColumns, p.getIdentifierColumnNames(), JoinFragment.INNER_JOIN ); return currentName; } --- 64,68 ---- q.addType(currentName, clazz); Loadable p = q.getPersister(clazz); ! join.addJoin( p.getTableName(), currentName, joinColumns, p.getIdentifierColumnNames(), joinType ); return currentName; } *************** *** 75,79 **** String alias = q.getPathAlias(path); if (alias!=null) { ! reset(); //reset the dotcount (but not the path) currentName = alias; //after reset! JoinFragment ojf = q.getPathJoin(path); --- 74,78 ---- String alias = q.getPathAlias(path); if (alias!=null) { ! reset(q); //reset the dotcount (but not the path) currentName = alias; //after reset! JoinFragment ojf = q.getPathJoin(path); *************** *** 157,167 **** String name= q.createNameForCollection(collectionRole); - /*if ( presetCollectionName==null || !p.isOneToMany() ) { - name = q.createNameForCollection(collectionRole); - } - else { - name = presetCollectionName; - } - presetCollectionName = null;*/ addJoin( p.getQualifiedTableName(), name, colNames, q ); --- 156,159 ---- *************** *** 215,220 **** } ! private void reset() { ! join = new QueryJoinFragment(); dotcount=0; currentName=null; --- 207,212 ---- } ! private void reset(QueryTranslator q) { ! join = q.createJoinFragment(); dotcount=0; currentName=null; *************** *** 236,240 **** public void start(QueryTranslator q) { if (!continuation) { ! reset(); path = StringHelper.EMPTY_STRING; } --- 228,232 ---- public void start(QueryTranslator q) { if (!continuation) { ! reset(q); path = StringHelper.EMPTY_STRING; } *************** *** 283,287 **** q.addCollection(collectionName, collectionRole); ! JoinFragment ojf = new QueryJoinFragment(); ojf.addCrossJoin( memberPersister.getQualifiedTableName(), collectionName ); q.addJoin(collectionName, ojf); --- 275,279 ---- q.addCollection(collectionName, collectionRole); ! JoinFragment ojf = q.createJoinFragment(); ojf.addCrossJoin( memberPersister.getQualifiedTableName(), collectionName ); q.addJoin(collectionName, ojf); *************** *** 296,300 **** //important!! continuation=false; - //presetCollectionName = null; } --- 288,291 ---- *************** *** 392,396 **** elementName = q.createNameFor(clazz); String[] keyColumnNames = p.getIdentifierColumnNames(); ! join.addJoin( p.getTableName(), elementName, collectionElementColumns, keyColumnNames, JoinFragment.INNER_JOIN); } q.addFromType(elementName, clazz, join); --- 383,387 ---- elementName = q.createNameFor(clazz); String[] keyColumnNames = p.getIdentifierColumnNames(); ! join.addJoin( p.getTableName(), elementName, collectionElementColumns, keyColumnNames, joinType); } q.addFromType(elementName, clazz, join); Index: QueryTranslator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/QueryTranslator.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** QueryTranslator.java 1 Mar 2003 02:45:26 -0000 1.14 --- QueryTranslator.java 1 Mar 2003 06:14:10 -0000 1.15 *************** *** 42,45 **** --- 42,46 ---- import net.sf.hibernate.util.StringHelper; + import org.apache.commons.collections.SequencedHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; *************** *** 51,56 **** public class QueryTranslator extends Loader { ! private final Map typeMap = new HashMap(); ! private final Map collections = new HashMap(); private List returnTypes = new ArrayList(); private final List fromTypes = new ArrayList(); --- 52,57 ---- public class QueryTranslator extends Loader { ! private final Map typeMap = new SequencedHashMap(); ! private final Map collections = new SequencedHashMap(); private List returnTypes = new ArrayList(); private final List fromTypes = new ArrayList(); *************** *** 324,328 **** void addCrossJoinedFromType(String name, Loadable classPersister) { ! JoinFragment ojf = new QueryJoinFragment(); ojf.addCrossJoin( classPersister.getTableName(), name ); addFromType( name, classPersister.getMappedClass(), ojf ); --- 325,329 ---- void addCrossJoinedFromType(String name, Loadable classPersister) { ! JoinFragment ojf = createJoinFragment(); ojf.addCrossJoin( classPersister.getTableName(), name ); addFromType( name, classPersister.getMappedClass(), ojf ); *************** *** 444,448 **** } ! QuerySelect sql = new QuerySelect(); sql.setDistinct(distinct); --- 445,449 ---- } ! QuerySelect sql = new QuerySelect( factory.getDialect() ); sql.setDistinct(distinct); *************** *** 656,660 **** if (keyColumnNames.length!=1) throw new QueryException("composite-key collection in filter: " + collectionRole); ! JoinFragment join = new QueryJoinFragment(); if ( persister.isOneToMany() ) { join.addCrossJoin( persister.getQualifiedTableName(), elementName ); --- 657,661 ---- if (keyColumnNames.length!=1) throw new QueryException("composite-key collection in filter: " + collectionRole); ! JoinFragment join = createJoinFragment(); if ( persister.isOneToMany() ) { join.addCrossJoin( persister.getQualifiedTableName(), elementName ); *************** *** 837,841 **** return (row.length==1) ? row[0] : row; } ! } --- 838,845 ---- return (row.length==1) ? row[0] : row; } ! } ! ! QueryJoinFragment createJoinFragment() { ! return new QueryJoinFragment( factory.getDialect() ); } Index: WhereParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/WhereParser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** WhereParser.java 28 Feb 2003 07:01:28 -0000 1.7 --- WhereParser.java 1 Mar 2003 06:14:10 -0000 1.8 *************** *** 15,19 **** import net.sf.hibernate.persister.Queryable; import net.sf.hibernate.sql.JoinFragment; - import net.sf.hibernate.sql.QueryJoinFragment; import net.sf.hibernate.type.EntityType; import net.sf.hibernate.type.LiteralType; --- 15,18 ---- *************** *** 373,377 **** else { JoinFragment ojf = pathExpressionParser.getWhereJoin(); ! JoinFragment fromClause = new QueryJoinFragment(); fromClause.addJoins( ojf.toFromFragmentString(), StringHelper.EMPTY_STRING ); q.addJoin( pathExpressionParser.getName(), fromClause ); --- 372,376 ---- else { JoinFragment ojf = pathExpressionParser.getWhereJoin(); ! JoinFragment fromClause = q.createJoinFragment(); fromClause.addJoins( ojf.toFromFragmentString(), StringHelper.EMPTY_STRING ); q.addJoin( pathExpressionParser.getName(), fromClause ); |
From: <one...@us...> - 2003-03-01 02:45:41
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql In directory sc8-pr-cvs1:/tmp/cvs-serv19202/sf/hibernate/hql Modified Files: FromParser.java QueryTranslator.java Log Message: finished implementing new FROM clause style Index: FromParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/FromParser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FromParser.java 28 Feb 2003 07:01:28 -0000 1.7 --- FromParser.java 1 Mar 2003 02:45:26 -0000 1.8 *************** *** 2,12 **** package net.sf.hibernate.hql; - import java.util.HashSet; - import java.util.Set; - import net.sf.hibernate.QueryException; import net.sf.hibernate.persister.Loadable; - import net.sf.hibernate.sql.JoinFragment; - import net.sf.hibernate.sql.QueryJoinFragment; import net.sf.hibernate.util.StringHelper; --- 2,7 ---- *************** *** 18,96 **** public class FromParser implements Parser { ! //private boolean expectingIn; private boolean expectingJoin; private boolean expectingAs; ! private String entityName; ! private boolean expectingJoinToken; ! private boolean fromClass; ! private String joinType; ! private String name; ! private PathExpressionParser peParser = new FromPathExpressionParser(); ! ! private static final Set joinTokens = new HashSet(); ! static { ! joinTokens.add("left"); ! joinTokens.add("right"); ! joinTokens.add("full"); ! } public void token(String token, QueryTranslator q) throws QueryException { String lcToken = token.toLowerCase(); ! if ( lcToken.equals("class") ) { ! fromClass = true; } ! else //if (expectingIn) { ! if ( lcToken.equals("in") ) { ! //expectingIn = false; ! } ! /*else { ! throw new QueryException("IN expected but found: " + token); ! }*/ ! //} ! else if (lcToken.equals("as") ) { ! if (!expectingAs) throw new QueryException("AS not expected here"); ! expectingAs=false; } ! else //if (expectingJoin) { ! if ( token.equals(StringHelper.COMMA) ) { ! expectingJoin = false; ! fromClass = false; ! joinType = StringHelper.COMMA; ! } ! else if ( lcToken.equals("join") ) { ! joinType += ' ' + lcToken; ! expectingJoin = false; ! fromClass = false; ! expectingJoinToken=false; } ! else if ( joinTokens.contains(lcToken) ) { ! joinType = ' ' + lcToken; ! expectingJoinToken = true; } ! /*else { ! throw new QueryException(", or WHERE expected but found: " + token); ! }*/ ! //} ! else //{ ! if ( name==null && token.indexOf(StringHelper.DOT)<0 ) { ! //expectingIn=true; ! if (entityName==null) { ! name = token; } else { ! q.setAliasName(token, entityName); } } else { ! if (fromClass) { ! Loadable p = q.getPersisterUsingImports(token); ! JoinFragment ojf = new QueryJoinFragment(); ! ojf.addCrossJoin( p.getTableName(), name ); ! q.addFromType( name, p.getMappedClass(), ojf ); ! name = null; ! expectingJoin=true; } else { ParserHelper.parse(peParser, q.unalias(token), ParserHelper.PATH_SEPARATORS, q); if ( peParser.isCollectionValued() ) { --- 13,128 ---- public class FromParser implements Parser { ! private PathExpressionParser peParser = new FromPathExpressionParser(); ! private String entityName; ! private String alias; ! private boolean afterIn; ! private boolean afterAs; ! private boolean afterClass; private boolean expectingJoin; + private boolean expectingIn; private boolean expectingAs; ! private Loadable classPersister; public void token(String token, QueryTranslator q) throws QueryException { + // start by looking for HQL keywords... String lcToken = token.toLowerCase(); ! if ( lcToken.equals(StringHelper.COMMA) ) { ! if (!expectingJoin) throw new QueryException("unexpected join: " + token); ! expectingJoin = false; } ! else if ( lcToken.equals("class") ) { ! if (!afterIn) throw new QueryException("unexpected token: class"); ! afterClass=true; } ! else if ( lcToken.equals("in") ) { ! if (!expectingIn) throw new QueryException("unexpected token: in"); ! afterIn = true; ! expectingIn = false; ! } ! else if ( lcToken.equals("as") ) { ! if (!expectingAs) throw new QueryException("unexpected token: as"); ! afterAs = true; ! expectingAs = false; ! } ! else { ! ! if (expectingIn || expectingJoin) { // AS is optional ! throw new QueryException("in or join expected: " + token); } ! ! // now anything that is not a HQL keyword ! ! if ( afterAs || expectingAs ) { ! ! // (AS is always optional, for consistency with SQL/OQL) ! ! // process the "new" HQL style where aliases are assigned ! // _after_ the class name or path expression ie. using ! // the AS construction ! ! if (classPersister!=null) { ! q.addCrossJoinedFromType(token, classPersister); ! } ! else if (entityName!=null) { ! q.setAliasName(token, entityName); ! } ! else { ! throw new QueryException("unexpected: as " + token); ! } ! afterAs = false; ! expectingJoin = true; ! expectingAs = false; ! entityName = null; ! classPersister = null; ! } ! else if (afterIn) { ! ! // process the "old" HQL style where aliases appear _first_ ! // ie. using the IN or IN CLASS constructions ! ! if (alias==null) throw new QueryException("alias not specified for: " + token); ! ! if (afterClass) { ! // treat it as a classname ! Loadable p = q.getPersisterUsingImports(token); ! if (p==null) throw new QueryException("persister not found: " + token); ! q.addCrossJoinedFromType(alias, p); } else { ! // treat it as a path expression ! ParserHelper.parse(peParser, q.unalias(token), ParserHelper.PATH_SEPARATORS, q); ! if ( !peParser.isCollectionValued() ) throw new QueryException("path expression did not resolve to collection: " + token); ! String nm = peParser.addFromCollection(q); ! q.setAliasName(alias, nm); } + + alias = null; + afterIn = false; + afterClass = false; + expectingJoin = true; } else { ! ! // handle a path expression or class name that ! // appears at the start, in the "new" HQL ! // style or an alias that appears at the start ! // in the "old" HQL style ! ! Loadable p = q.getPersisterUsingImports(token); ! if (p!=null) { ! // starts with the name of a mapped class (new style) ! classPersister = p; ! expectingAs = true; ! } ! else if ( token.indexOf('.') < 0 ) { ! // starts with an alias (old style) ! // semi-bad thing about this: can't re-alias another alias..... ! alias = token; ! expectingIn = true; } else { + // starts with a path expression (new style) ParserHelper.parse(peParser, q.unalias(token), ParserHelper.PATH_SEPARATORS, q); if ( peParser.isCollectionValued() ) { *************** *** 98,126 **** } else { ! entityName = peParser.addFromAssociation(q); ! ! } ! if (name!=null) { ! q.setAliasName(name, entityName); ! name = null; ! expectingJoin=true; ! entityName = null; ! } ! else { ! expectingAs = true; } ! ! //} } } } public void start(QueryTranslator q) { ! //expectingIn = false; expectingJoin = false; ! expectingJoinToken = false; ! joinType = null; ! name = null; ! fromClass = false; } --- 130,152 ---- } else { ! entityName = peParser.addFromAssociation(q); } ! expectingAs = true; ! } } } + } public void start(QueryTranslator q) { ! entityName = null; ! classPersister = null; ! alias = null; ! afterIn = false; ! afterAs = false; ! afterClass = false; expectingJoin = false; ! expectingIn = false; ! expectingAs = false; } Index: QueryTranslator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/QueryTranslator.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** QueryTranslator.java 28 Feb 2003 07:01:28 -0000 1.13 --- QueryTranslator.java 1 Mar 2003 02:45:26 -0000 1.14 *************** *** 323,326 **** --- 323,332 ---- } + void addCrossJoinedFromType(String name, Loadable classPersister) { + JoinFragment ojf = new QueryJoinFragment(); + ojf.addCrossJoin( classPersister.getTableName(), name ); + addFromType( name, classPersister.getMappedClass(), ojf ); + } + void addReturnType(String name) { returnTypes.add(name); |
From: <one...@us...> - 2003-03-01 02:45:41
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv19202/sf/hibernate/test Modified Files: FooBarTest.java Log Message: finished implementing new FROM clause style Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** FooBarTest.java 28 Feb 2003 07:01:28 -0000 1.29 --- FooBarTest.java 1 Mar 2003 02:45:27 -0000 1.30 *************** *** 262,265 **** --- 262,268 ---- s.save(bar); + s.find("select baz.name from Bar bar, bar.baz baz, baz.fooSet foo where baz.name = bar.string"); + s.find("SELECT baz.name FROM Bar AS bar, bar.baz AS baz, baz.fooSet AS foo WHERE baz.name = bar.string"); + s.find("select bar.string, foo.string from bar in class Bar, bar.baz as baz, elements(baz.fooSet) as foo where baz.name = 'name'"); s.find("select foo from bar in class Bar, bar.baz as baz, baz.fooSet as foo"); *************** *** 363,368 **** public void testPersistCollections() throws Exception { - - if ( dialect instanceof SybaseDialect ) return; Session s = sessions.openSession(); --- 366,369 ---- |
From: <one...@us...> - 2003-02-28 07:03:50
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql In directory sc8-pr-cvs1:/tmp/cvs-serv28314/sf/hibernate/hql Added Files: FromPathExpressionParser.java Log Message: reworked HQL, adding support for AS syntax in FROM clause non-collection associations may now be aliased --- NEW FILE: FromPathExpressionParser.java --- //$Id: FromPathExpressionParser.java,v 1.1 2003/02/28 07:03:48 oneovthafew Exp $ package net.sf.hibernate.hql; import net.sf.hibernate.QueryException; import net.sf.hibernate.type.Type; public class FromPathExpressionParser extends PathExpressionParser { public void end(QueryTranslator q) throws QueryException { if ( !isCollectionValued() ) { Type type = getPropertyType(q); if ( type.isEntityType() ) { // "finish off" the join token(".", q); token(null, q); } else if ( type.isPersistentCollectionType() ) { // default to element set if no elements() specified token(".", q); token(COLLECTION_ELEMENTS, q); } } super.end(q); } protected void setExpectingCollectionIndex() throws QueryException { throw new QueryException("expecting .elements or .indices after collection path expression in from"); } } |
From: <one...@us...> - 2003-02-28 07:01:31
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv27226/sf/hibernate/test Modified Files: FooBarTest.java SQLFunctionsTest.java Log Message: reworked HQL, adding support for AS syntax in FROM clause non-collection associations may now be aliased Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** FooBarTest.java 24 Feb 2003 11:53:44 -0000 1.28 --- FooBarTest.java 28 Feb 2003 07:01:28 -0000 1.29 *************** *** 262,265 **** --- 262,268 ---- s.save(bar); + s.find("select bar.string, foo.string from bar in class Bar, bar.baz as baz, elements(baz.fooSet) as foo where baz.name = 'name'"); + s.find("select foo from bar in class Bar, bar.baz as baz, baz.fooSet as foo"); + assertTrue( s.find("from bar in class Bar, foo in bar.baz.fooSet.elements").size()==0 ); assertTrue( s.find("from bar in class Bar, foo in elements( bar.baz.fooArray )").size()==1 ); *************** *** 868,871 **** --- 871,876 ---- s.find("select foo.string from foo in class Foo where foo.foo.foo = 'bar' and foo.foo.foo.foo = 'baz'"); s.find("select foo.string from foo in class Foo where foo.foo.foo.foo.string = 'a' and foo.foo.string = 'b'"); + + s.find("from bar in class Bar, foo in elements(bar.baz.fooArray)"); if ( dialect instanceof DB2Dialect) { Index: SQLFunctionsTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/SQLFunctionsTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SQLFunctionsTest.java 23 Feb 2003 01:32:21 -0000 1.5 --- SQLFunctionsTest.java 28 Feb 2003 07:01:29 -0000 1.6 *************** *** 173,177 **** //b.getBlob().setBytes( 2, "abc".getBytes() ); b.getClob().getSubString(2, 3); ! b.getClob().setString(2, "abc"); s.flush(); s.connection().commit(); --- 173,177 ---- //b.getBlob().setBytes( 2, "abc".getBytes() ); b.getClob().getSubString(2, 3); ! //b.getClob().setString(2, "abc"); s.flush(); s.connection().commit(); *************** *** 186,190 **** //assertTrue( b.getClob().getSubString(1, 3).equals("fab") ); b.getClob().getSubString(1, 6); ! b.getClob().setString(1, "qwerty"); s.flush(); s.connection().commit(); --- 186,190 ---- //assertTrue( b.getClob().getSubString(1, 3).equals("fab") ); b.getClob().getSubString(1, 6); ! //b.getClob().setString(1, "qwerty"); s.flush(); s.connection().commit(); *************** *** 201,205 **** b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) ); assertTrue( b.getClob().getSubString(1, 7).equals("xcvfxvc") ); ! b.getClob().setString(5, "1234567890"); s.flush(); s.connection().commit(); --- 201,205 ---- b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) ); assertTrue( b.getClob().getSubString(1, 7).equals("xcvfxvc") ); ! //b.getClob().setString(5, "1234567890"); s.flush(); s.connection().commit(); |
From: <one...@us...> - 2003-02-28 07:01:31
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql In directory sc8-pr-cvs1:/tmp/cvs-serv27226/sf/hibernate/hql Modified Files: FromParser.java GroupByParser.java OrderByParser.java ParserHelper.java PathExpressionParser.java QueryTranslator.java SelectParser.java SelectPathExpressionParser.java WhereParser.java Log Message: reworked HQL, adding support for AS syntax in FROM clause non-collection associations may now be aliased Index: FromParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/FromParser.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FromParser.java 23 Feb 2003 07:22:11 -0000 1.6 --- FromParser.java 28 Feb 2003 07:01:28 -0000 1.7 *************** *** 18,28 **** public class FromParser implements Parser { ! private boolean expectingIn; private boolean expectingJoin; private boolean expectingJoinToken; private boolean fromClass; private String joinType; private String name; ! private PathExpressionParser peParser = new PathExpressionParser(); private static final Set joinTokens = new HashSet(); --- 18,30 ---- public class FromParser implements Parser { ! //private boolean expectingIn; private boolean expectingJoin; + private boolean expectingAs; + private String entityName; private boolean expectingJoinToken; private boolean fromClass; private String joinType; private String name; ! private PathExpressionParser peParser = new FromPathExpressionParser(); private static final Set joinTokens = new HashSet(); *************** *** 39,51 **** fromClass = true; } ! else if (expectingIn) { if ( lcToken.equals("in") ) { ! expectingIn = false; } ! else { throw new QueryException("IN expected but found: " + token); ! } } ! else if (expectingJoin) { if ( token.equals(StringHelper.COMMA) ) { expectingJoin = false; --- 41,57 ---- fromClass = true; } ! else //if (expectingIn) { if ( lcToken.equals("in") ) { ! //expectingIn = false; } ! /*else { throw new QueryException("IN expected but found: " + token); ! }*/ ! //} ! else if (lcToken.equals("as") ) { ! if (!expectingAs) throw new QueryException("AS not expected here"); ! expectingAs=false; } ! else //if (expectingJoin) { if ( token.equals(StringHelper.COMMA) ) { expectingJoin = false; *************** *** 63,74 **** expectingJoinToken = true; } ! else { throw new QueryException(", or WHERE expected but found: " + token); ! } ! } ! else { ! if (name==null) { ! name = token; ! expectingIn=true; } else { --- 69,85 ---- expectingJoinToken = true; } ! /*else { throw new QueryException(", or WHERE expected but found: " + token); ! }*/ ! //} ! else //{ ! if ( name==null && token.indexOf(StringHelper.DOT)<0 ) { ! //expectingIn=true; ! if (entityName==null) { ! name = token; ! } ! else { ! q.setAliasName(token, entityName); ! } } else { *************** *** 78,89 **** ojf.addCrossJoin( p.getTableName(), name ); q.addFromType( name, p.getMappedClass(), ojf ); } else { ! peParser.presetCollectionName(name); ! ParserHelper.parse(peParser, token, ParserHelper.PATH_SEPERATORS, q); ! peParser.addFromCollection(q, name, JoinFragment.INNER_JOIN); ! } ! name = null; ! expectingJoin=true; } } --- 89,115 ---- ojf.addCrossJoin( p.getTableName(), name ); q.addFromType( name, p.getMappedClass(), ojf ); + name = null; + expectingJoin=true; } else { ! ParserHelper.parse(peParser, q.unalias(token), ParserHelper.PATH_SEPARATORS, q); ! if ( peParser.isCollectionValued() ) { ! entityName = peParser.addFromCollection(q); ! } ! else { ! entityName = peParser.addFromAssociation(q); ! ! } ! if (name!=null) { ! q.setAliasName(name, entityName); ! name = null; ! expectingJoin=true; ! entityName = null; ! } ! else { ! expectingAs = true; ! } ! ! //} } } *************** *** 91,95 **** public void start(QueryTranslator q) { ! expectingIn = false; expectingJoin = false; expectingJoinToken = false; --- 117,121 ---- public void start(QueryTranslator q) { ! //expectingIn = false; expectingJoin = false; expectingJoinToken = false; Index: GroupByParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/GroupByParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GroupByParser.java 23 Feb 2003 01:32:20 -0000 1.4 --- GroupByParser.java 28 Feb 2003 07:01:28 -0000 1.5 *************** *** 25,31 **** if ( q.isName( StringHelper.root(token) ) ) { ! ParserHelper.parse(pathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); q.appendGroupByToken( pathExpressionParser.getWhereColumn() ); ! q.addJoin( pathExpressionParser.getName(), pathExpressionParser.getWhereJoin() ); } else { --- 25,31 ---- if ( q.isName( StringHelper.root(token) ) ) { ! ParserHelper.parse(pathExpressionParser, q.unalias(token), ParserHelper.PATH_SEPARATORS, q); q.appendGroupByToken( pathExpressionParser.getWhereColumn() ); ! pathExpressionParser.addFromAssociation(q); } else { Index: OrderByParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/OrderByParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** OrderByParser.java 23 Feb 2003 01:32:20 -0000 1.4 --- OrderByParser.java 28 Feb 2003 07:01:28 -0000 1.5 *************** *** 24,30 **** if ( q.isName( StringHelper.root(token) ) ) { ! ParserHelper.parse(pathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); q.appendOrderByToken( pathExpressionParser.getWhereColumn() ); ! q.addJoin( pathExpressionParser.getName(), pathExpressionParser.getWhereJoin() ); } else { --- 24,30 ---- if ( q.isName( StringHelper.root(token) ) ) { ! ParserHelper.parse(pathExpressionParser, q.unalias(token), ParserHelper.PATH_SEPARATORS, q); q.appendOrderByToken( pathExpressionParser.getWhereColumn() ); ! pathExpressionParser.addFromAssociation(q); } else { Index: ParserHelper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/ParserHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ParserHelper.java 5 Jan 2003 02:11:21 -0000 1.3 --- ParserHelper.java 28 Feb 2003 07:01:28 -0000 1.4 *************** *** 10,16 **** public static final String HQL_VARIABLE_PREFIX = ":"; ! public static final String HQL_SEPERATORS = " \n\r\f\t,()=<>&|+-=/*'^![]#~"; //NOTICE: no " or . since they are part of (compound) identifiers ! public static final String PATH_SEPERATORS = "."; public static final String whitespace = " \n\r\f\t"; --- 10,16 ---- public static final String HQL_VARIABLE_PREFIX = ":"; ! public static final String HQL_SEPARATORS = " \n\r\f\t,()=<>&|+-=/*'^![]#~"; //NOTICE: no " or . since they are part of (compound) identifiers ! public static final String PATH_SEPARATORS = "."; public static final String whitespace = " \n\r\f\t"; Index: PathExpressionParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/PathExpressionParser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PathExpressionParser.java 23 Feb 2003 07:22:11 -0000 1.8 --- PathExpressionParser.java 28 Feb 2003 07:01:28 -0000 1.9 *************** *** 39,43 **** protected String[] columns; protected String[] collectionElementColumns; ! private String collectionName; private String collectionRole; private String collectionTable; --- 39,43 ---- protected String[] columns; protected String[] collectionElementColumns; ! protected String collectionName; private String collectionRole; private String collectionTable; *************** *** 48,56 **** private boolean skippedId; private boolean continuation; ! private String presetCollectionName; ! void presetCollectionName(String name) { presetCollectionName=name; ! } private void addJoin(String table, String name, String[] rhsCols, QueryTranslator q) throws QueryException { --- 48,56 ---- private boolean skippedId; private boolean continuation; ! //private String presetCollectionName; ! /*void presetCollectionName(String name) { presetCollectionName=name; ! }*/ private void addJoin(String table, String name, String[] rhsCols, QueryTranslator q) throws QueryException { *************** *** 109,113 **** if (propertyType==null) { ! throw new QueryException("unresolved property: " + currentProperty); } --- 109,113 ---- if (propertyType==null) { ! throw new QueryException("unresolved property: " + path); } *************** *** 156,161 **** String[] colNames = p.getKeyColumnNames(); ! String name; ! if ( presetCollectionName==null || !p.isOneToMany() ) { name = q.createNameForCollection(collectionRole); } --- 156,161 ---- String[] colNames = p.getKeyColumnNames(); ! String name= q.createNameForCollection(collectionRole); ! /*if ( presetCollectionName==null || !p.isOneToMany() ) { name = q.createNameForCollection(collectionRole); } *************** *** 163,167 **** name = presetCollectionName; } ! presetCollectionName = null; addJoin( p.getQualifiedTableName(), name, colNames, q ); --- 163,167 ---- name = presetCollectionName; } ! presetCollectionName = null;*/ addJoin( p.getQualifiedTableName(), name, colNames, q ); *************** *** 176,181 **** else { if (token!=null) throw new QueryException( ! "dereferenced: " + ! currentProperty ); } --- 176,180 ---- else { if (token!=null) throw new QueryException( ! "dereferenced: " + path ); } *************** *** 208,212 **** } ! private Type getPropertyType(QueryTranslator q) throws QueryException { return q.getPersisterForName(currentName).getPropertyType( getPropertyPath() ); } --- 207,211 ---- } ! protected Type getPropertyType(QueryTranslator q) throws QueryException { return q.getPersisterForName(currentName).getPropertyType( getPropertyPath() ); } *************** *** 261,267 **** CollectionPersister memberPersister = q.getCollectionPersister(collectionRole); ! if ( !memberPersister.hasIndex() ) throw new QueryException("unindexed collection before []"); String[] indexCols = memberPersister.getIndexColumnNames(); ! if ( indexCols.length!=1 ) throw new QueryException("composite-index appears in []"); String[] keyCols = memberPersister.getKeyColumnNames(); --- 260,266 ---- CollectionPersister memberPersister = q.getCollectionPersister(collectionRole); ! if ( !memberPersister.hasIndex() ) throw new QueryException("unindexed collection before []: " + path); String[] indexCols = memberPersister.getIndexColumnNames(); ! if ( indexCols.length!=1 ) throw new QueryException("composite-index appears in []: " + path); String[] keyCols = memberPersister.getKeyColumnNames(); *************** *** 297,301 **** //important!! continuation=false; ! presetCollectionName = null; } --- 296,300 ---- //important!! continuation=false; ! //presetCollectionName = null; } *************** *** 333,337 **** public String getWhereColumn() throws QueryException { ! if (columns.length!=1) throw new QueryException("path expression ends in a composite value"); return columns[0]; } --- 332,336 ---- public String getWhereColumn() throws QueryException { ! if (columns.length!=1) throw new QueryException("path expression ends in a composite value: " + path); return columns[0]; } *************** *** 349,353 **** public String getCollectionSubquery() throws QueryException { ! return new StringBuffer( "SELECT " ) .append( StringHelper.join( ", ", collectionElementColumns ) ) --- 348,352 ---- public String getCollectionSubquery() throws QueryException { ! //TODO: refactor to .sql package return new StringBuffer( "SELECT " ) .append( StringHelper.join( ", ", collectionElementColumns ) ) *************** *** 366,392 **** } ! public void addFromCollection(QueryTranslator q, String elementName, int joinType) throws QueryException { ! if ( collectionElementType==null ) throw new QueryException("must specify 'elements' for collection valued property in from clause: " + elementName); if ( !collectionElementType.isEntityType() ) throw new QueryException( ! "collection of values in from clause: " + elementName ); EntityType elemType = (EntityType) collectionElementType; ! CollectionPersister persister = q.getCollectionPersister(collectionRole); if ( persister.isOneToMany() ) { ! //join.addCrossJoin( persister.getQualifiedTableName(), elementName ); } else { q.addCollection(collectionName, collectionRole); ! //join.addCrossJoin( persister.getQualifiedTableName(), collectionName ); ! Loadable p = q.getPersister( elemType.getPersistentClass() ); String[] keyColumnNames = p.getIdentifierColumnNames(); ! join.addJoin( p.getTableName(), elementName, collectionElementColumns, keyColumnNames, joinType); } ! q.addFromType( elementName, elemType.getPersistentClass(), join ); ! // q.addJoin(join); } --- 365,400 ---- } ! public String addFromAssociation(QueryTranslator q) { ! q.addJoin( getName(), join ); ! return currentName; ! } ! ! public String addFromCollection(QueryTranslator q) throws QueryException { ! if ( collectionElementType==null ) throw new QueryException( ! "must specify 'elements' for collection valued property in from clause: " + path ! ); if ( !collectionElementType.isEntityType() ) throw new QueryException( ! "collection of values in from clause: " + path ); EntityType elemType = (EntityType) collectionElementType; ! Class clazz = elemType.getPersistentClass(); CollectionPersister persister = q.getCollectionPersister(collectionRole); + final String elementName; if ( persister.isOneToMany() ) { ! elementName = collectionName; } else { q.addCollection(collectionName, collectionRole); ! Loadable p = q.getPersister(clazz); ! elementName = q.createNameFor(clazz); String[] keyColumnNames = p.getIdentifierColumnNames(); ! join.addJoin( p.getTableName(), elementName, collectionElementColumns, keyColumnNames, JoinFragment.INNER_JOIN); } ! q.addFromType(elementName, clazz, join); ! ! return elementName; } *************** *** 444,448 **** } else { ! throw new QueryException("expecting 'elements' or 'indices' after " + currentProperty + StringHelper.DOT); } } --- 452,456 ---- } else { ! throw new QueryException("expecting 'elements' or 'indices' after: " + path); } } Index: QueryTranslator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/QueryTranslator.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** QueryTranslator.java 23 Feb 2003 07:22:11 -0000 1.12 --- QueryTranslator.java 28 Feb 2003 07:01:28 -0000 1.13 *************** *** 16,19 **** --- 16,20 ---- import java.util.StringTokenizer; + import net.sf.hibernate.AssertionFailure; import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; *************** *** 29,37 **** import net.sf.hibernate.impl.ScrollableResultsImpl; import net.sf.hibernate.loader.Loader; - import net.sf.hibernate.loader.OuterJoinLoader; import net.sf.hibernate.persister.Loadable; import net.sf.hibernate.persister.Queryable; import net.sf.hibernate.sql.JoinFragment; import net.sf.hibernate.sql.QueryJoinFragment; import net.sf.hibernate.type.EntityType; import net.sf.hibernate.type.Type; --- 30,38 ---- import net.sf.hibernate.impl.ScrollableResultsImpl; import net.sf.hibernate.loader.Loader; import net.sf.hibernate.persister.Loadable; import net.sf.hibernate.persister.Queryable; import net.sf.hibernate.sql.JoinFragment; import net.sf.hibernate.sql.QueryJoinFragment; + import net.sf.hibernate.sql.QuerySelect; import net.sf.hibernate.type.EntityType; import net.sf.hibernate.type.Type; *************** *** 50,82 **** public class QueryTranslator extends Loader { - private static final HashSet dontSpace = new HashSet(); - static { - //dontSpace.add("'"); - dontSpace.add("."); - dontSpace.add("+"); - dontSpace.add("-"); - dontSpace.add("/"); - dontSpace.add("*"); - dontSpace.add("<"); - dontSpace.add(">"); - dontSpace.add("="); - dontSpace.add("#"); - dontSpace.add("~"); - dontSpace.add("|"); - dontSpace.add("&"); - dontSpace.add("<="); - dontSpace.add(">="); - dontSpace.add("=>"); - dontSpace.add("=<"); - dontSpace.add("!="); - dontSpace.add("<>"); - dontSpace.add("!#"); - dontSpace.add("!~"); - dontSpace.add("!<"); - dontSpace.add("!>"); - dontSpace.add(StringHelper.OPEN_PAREN); //for MySQL - dontSpace.add(StringHelper.CLOSE_PAREN); - } - private final Map typeMap = new HashMap(); private final Map collections = new HashMap(); --- 51,54 ---- *************** *** 85,88 **** --- 57,61 ---- private final List scalarTypes = new ArrayList(); private final Map namedParameters = new HashMap(); + private final HashMap aliasNames = new HashMap(); private final List scalarSelectTokens = new ArrayList(); *************** *** 103,110 **** private String queryString; private boolean distinct=false; - private String fromWhereString; - private String selectPropertiesString; - private String scalarSelectString; protected boolean compiled; private boolean hasScalars; --- 76,81 ---- private String queryString; private boolean distinct=false; protected boolean compiled; + private String sqlString; private boolean hasScalars; *************** *** 159,163 **** new PreprocessingParser(replacements), queryString, ! ParserHelper.HQL_SEPERATORS, this ); --- 130,134 ---- new PreprocessingParser(replacements), queryString, ! ParserHelper.HQL_SEPARATORS, this ); *************** *** 213,216 **** --- 184,202 ---- } + void setAliasName(String alias, String name) { + aliasNames.put(alias, name); + } + + String unalias(String path) { + String alias = StringHelper.root(path); + String name = (String) aliasNames.get(alias); + if (name!=null) { + return name + path.substring( alias.length() ); + } + else { + return path; + } + } + /** * Return the SQL for a <tt>find()</tt> style query. *************** *** 218,227 **** */ protected String getSQLString() { ! String result = new StringBuffer(50) ! .append(selectPropertiesString) ! .append(fromWhereString) ! .toString(); ! logQuery(queryString, result); ! return result; } --- 204,210 ---- */ protected String getSQLString() { ! if ( shallowQuery ) throw new AssertionFailure(""); ! logQuery(queryString, sqlString); ! return sqlString; } *************** *** 231,240 **** */ protected String getScalarSelectSQL() { ! String result= new StringBuffer(50) ! .append(scalarSelectString) ! .append(fromWhereString) ! .toString(); ! logQuery(queryString, result); ! return result; } --- 214,220 ---- */ protected String getScalarSelectSQL() { ! if ( !shallowQuery ) throw new AssertionFailure(""); ! logQuery(queryString, sqlString); ! return sqlString; } *************** *** 274,278 **** boolean isName(String name) { ! return typeMap.containsKey(name) || collections.containsKey(name) || ( superQuery!=null && superQuery.isName(name) --- 254,259 ---- boolean isName(String name) { ! return aliasNames.containsKey(name) || ! typeMap.containsKey(name) || collections.containsKey(name) || ( superQuery!=null && superQuery.isName(name) *************** *** 438,502 **** } int size = returnTypes.size(); ! ! String outerJoinedProperties=null; ! JoinFragment outerjoin=null; ! String selectProperties; ! String selectIdentifiers; ! if ( !isShallowQuery() && returnTypes.size()==1 && typeMap.size()==1 ) { ! OuterJoinLoader ojl = new OuterJoinLoader( factory.getDialect() ); ! String name = (String) returnTypes.get(0); ! if ( !isName(name) ) throw new QueryException("unknown type: " + name); ! Queryable persister = getPersisterForName(name); ! associations = ojl.walkTree(persister, name, factory); ! int joins=associations.size(); ! String[] ojsuffixes = new String[joins]; ! for ( int i=0; i<joins; i++ ) ojsuffixes[i] = Integer.toString(i) + StringHelper.UNDERSCORE; ! ojl.setSuffixes(ojsuffixes); ! selectProperties = persister.propertySelectFragment(name, StringHelper.EMPTY_STRING); ! selectIdentifiers = persister.identifierSelectFragment(name, StringHelper.EMPTY_STRING); ! outerJoinedProperties = ojl.selectString(associations); ! outerjoin = ojl.outerJoins(associations); ! persisters = new Queryable[joins+1]; ! suffixes = new String[joins+1]; ! persisters[joins] = persister; ! suffixes[joins] = StringHelper.EMPTY_STRING; ! for ( int i=0; i<joins; i++ ) { ! suffixes[i] = Integer.toString(i) + StringHelper.UNDERSCORE; ! persisters[i] = (Queryable) ( (OuterJoinLoader.OuterJoinableAssociation) associations.get(i) ).subpersister; //TODO: dont like the typecast to Queryable ! } ! } ! else { ! persisters = new Queryable[size]; ! suffixes = new String[size]; ! for ( int i=0; i<size; i++ ) { ! String name = (String) returnTypes.get(i); ! if ( !isName(name) ) throw new QueryException("unknown type: " + name); ! persisters[i] = getPersisterForName(name); ! suffixes[i] = (size==1) ? StringHelper.EMPTY_STRING : Integer.toString(i) + StringHelper.UNDERSCORE; ! } ! selectProperties = renderPropertiesSelect(); ! selectIdentifiers = renderIdentifierSelect(); } ! String selectPerhapsDistinct = "SELECT "; ! if (distinct) selectPerhapsDistinct += "DISTINCT "; ! String selectScalars = renderScalarSelect(); ! scalarSelectString = selectPerhapsDistinct + selectScalars; ! selectPropertiesString = selectPerhapsDistinct + selectIdentifiers + selectProperties; ! if ( outerJoinedProperties!=null && outerJoinedProperties.length() > 0 ) selectPropertiesString += ", " + outerJoinedProperties; ! //TODO: for some dialiects it would be appropriate to add the renderOrderByPropertiesSelect() to other select strings ! JoinFragment mergedJoins = mergeJoins(outerjoin); ! fromWhereString = " FROM" + mergedJoins.toFromFragmentString().substring(1) + renderWhereClause(mergedJoins); ! ! if ( scalarTypes.size()!=size ) { ! hasScalars=true; ! if (size!=0) selectPropertiesString += ", "; ! selectPropertiesString += selectScalars; ! } ! else { ! hasScalars=false; ! } int scalarSize = scalarTypes.size(); types = new Type[scalarSize]; for ( int i=0; i<scalarSize; i++ ) { --- 419,436 ---- } int size = returnTypes.size(); ! persisters = new Queryable[size]; ! suffixes = new String[size]; ! for ( int i=0; i<size; i++ ) { ! String name = (String) returnTypes.get(i); ! //if ( !isName(name) ) throw new QueryException("unknown type: " + name); ! persisters[i] = getPersisterForName(name); ! suffixes[i] = (size==1) ? StringHelper.EMPTY_STRING : Integer.toString(i) + StringHelper.UNDERSCORE; } ! String scalarSelect = renderScalarSelect(); //Must be done here because of side-effect! yuck... int scalarSize = scalarTypes.size(); + hasScalars = scalarTypes.size()!=size; + types = new Type[scalarSize]; for ( int i=0; i<scalarSize; i++ ) { *************** *** 504,507 **** --- 438,460 ---- } + QuerySelect sql = new QuerySelect(); + sql.setDistinct(distinct); + + if ( !shallowQuery ) { + renderIdentifierSelect(sql); + renderPropertiesSelect(sql); + } + + if ( hasScalars || shallowQuery ) sql.addSelectFragmentString(scalarSelect); + + //TODO: for some dialiects it would be appropriate to add the renderOrderByPropertiesSelect() to other select strings + mergeJoins( sql.getJoinFragment() ); + + sql.setWhereTokens( whereTokens.iterator() ); + + sql.setGroupByTokens( groupByTokens.iterator() ); + sql.setHavingTokens( havingTokens.iterator() ); + sql.setOrderByTokens( orderByTokens.iterator() ); + scalarColumnNames = generateColumnNames(types, factory); *************** *** 518,525 **** } } ! private String renderIdentifierSelect() { ! StringBuffer buf = new StringBuffer(40); int size = returnTypes.size(); --- 471,479 ---- } + sqlString = sql.toQueryString(); + } ! private void renderIdentifierSelect(QuerySelect sql) { int size = returnTypes.size(); *************** *** 527,538 **** String name = (String) returnTypes.get(k); String suffix = size==1 ? StringHelper.EMPTY_STRING : Integer.toString(k) + StringHelper.UNDERSCORE; ! buf.append( persisters[k].identifierSelectFragment(name, suffix) ); ! if ( k!=size-1 ) buf.append(StringHelper.COMMA_SPACE); } - return buf.toString(); } ! private String renderOrderByPropertiesSelect() { StringBuffer buf = new StringBuffer(10); --- 481,490 ---- String name = (String) returnTypes.get(k); String suffix = size==1 ? StringHelper.EMPTY_STRING : Integer.toString(k) + StringHelper.UNDERSCORE; ! sql.addSelectFragmentString( persisters[k].identifierSelectFragment(name, suffix) ); } } ! /*private String renderOrderByPropertiesSelect() { StringBuffer buf = new StringBuffer(10); *************** *** 548,562 **** return buf.toString(); ! } ! private String renderPropertiesSelect() { ! StringBuffer buf = new StringBuffer(40); int size = returnTypes.size(); for ( int k=0; k<size; k++ ) { String suffix = (size==1) ? StringHelper.EMPTY_STRING : Integer.toString(k) + StringHelper.UNDERSCORE; String name = (String) returnTypes.get(k) ; ! buf.append( persisters[k].propertySelectFragment(name, suffix) ); } - return buf.toString(); } --- 500,512 ---- return buf.toString(); ! }*/ ! private void renderPropertiesSelect(QuerySelect sql) { int size = returnTypes.size(); for ( int k=0; k<size; k++ ) { String suffix = (size==1) ? StringHelper.EMPTY_STRING : Integer.toString(k) + StringHelper.UNDERSCORE; String name = (String) returnTypes.get(k) ; ! sql.addSelectFragmentString( persisters[k].propertySelectFragment(name, suffix) ); } } *************** *** 630,635 **** } ! private JoinFragment mergeJoins(JoinFragment outerjoin) throws MappingException, QueryException { ! JoinFragment ojf = new QueryJoinFragment(); //classes --- 580,584 ---- } ! private JoinFragment mergeJoins(JoinFragment ojf) throws MappingException, QueryException { //classes *************** *** 650,657 **** } - // add any outerjoins required for association fetching - // TODO: (need to move inside loop, eventually) - if (outerjoin!=null) ojf.addFragment(outerjoin); - iter = collections.keySet().iterator(); while ( iter.hasNext() ) { --- 599,602 ---- *************** *** 663,727 **** } - private String renderWhereClause(JoinFragment mergedJoins) throws QueryException, MappingException { - - //SET UP IDENTIFIER SPACES. TODO: move elsewhere! - - Iterator iter = typeMap.keySet().iterator(); - while ( iter.hasNext() ) { - String name = (String) iter.next(); - Queryable p = getPersisterForName(name); - addIdentifierSpace( p.getIdentifierSpace() ); - } - - StringBuffer buf = new StringBuffer(120); - - StringBuffer whereTokenBuf = new StringBuffer(40); - appendTokens( whereTokenBuf, whereTokens.iterator() ); - - String part2 = mergedJoins.toWhereFragmentString(); - String part3 = whereTokenBuf.toString().trim(); - - boolean hasPart2 = part2.length()!=0; - boolean hasPart3 = part3.length()!=0; - - if (hasPart2 || hasPart3) buf.append(" WHERE "); - if (hasPart2) buf.append( part2.substring(5) ); //remove leading "and " - if (hasPart3) { - if (hasPart2) buf.append(" AND ("); - buf.append(part3); - if (hasPart2) buf.append(')'); - } - - if ( groupByTokens.size()!=0 ) { - //GROUP BY - buf.append(" GROUP BY "); - appendTokens( buf, groupByTokens.iterator() ); - } - - if ( havingTokens.size()!=0 ) { - buf.append(" HAVING "); - appendTokens( buf, havingTokens.iterator() ); - } - - if ( orderByTokens.size()!=0 ) { - //ORDER BY - buf.append(" ORDER BY "); - appendTokens( buf, orderByTokens.iterator() ); - } - - return buf.toString(); - } - - private void appendTokens(StringBuffer buf, Iterator iter) { - boolean lastSpaceable=true; - while ( iter.hasNext() ) { - String token = (String) iter.next(); - boolean spaceable = !dontSpace.contains(token); - if (spaceable && lastSpaceable) buf.append(' '); - lastSpaceable = spaceable; - buf.append(token); - } - } - public Set getQuerySpaces() { return identifierSpaces; --- 608,611 ---- *************** *** 789,793 **** } addFromType( elementName, elemType.getPersistentClass(), join ); - // addJoin(join); } --- 673,676 ---- Index: SelectParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/SelectParser.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SelectParser.java 23 Feb 2003 01:32:20 -0000 1.5 --- SelectParser.java 28 Feb 2003 07:01:28 -0000 1.6 *************** *** 97,101 **** else if (aggregate) { if (!ready) throw new QueryException("( expected after aggregate function in SELECT"); ! ParserHelper.parse(aggregatePathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); if ( aggregatePathExpressionParser.isCollectionValued() ) { --- 97,101 ---- else if (aggregate) { if (!ready) throw new QueryException("( expected after aggregate function in SELECT"); ! ParserHelper.parse(aggregatePathExpressionParser, q.unalias(token), ParserHelper.PATH_SEPARATORS, q); if ( aggregatePathExpressionParser.isCollectionValued() ) { *************** *** 107,116 **** q.appendScalarSelectToken( aggregatePathExpressionParser.getWhereColumn() ); if (!count) q.addScalarType( aggregatePathExpressionParser.getWhereColumnType() ); ! q.addJoin( aggregatePathExpressionParser.getName(), aggregatePathExpressionParser.getWhereJoin() ); } else { if (!ready) throw new QueryException(", expected in SELECT"); ! ParserHelper.parse(pathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); if ( pathExpressionParser.isCollectionValued() ) { q.addCollection( --- 107,116 ---- q.appendScalarSelectToken( aggregatePathExpressionParser.getWhereColumn() ); if (!count) q.addScalarType( aggregatePathExpressionParser.getWhereColumnType() ); ! aggregatePathExpressionParser.addFromAssociation(q); } else { if (!ready) throw new QueryException(", expected in SELECT"); ! ParserHelper.parse(pathExpressionParser, q.unalias(token), ParserHelper.PATH_SEPARATORS, q); if ( pathExpressionParser.isCollectionValued() ) { q.addCollection( *************** *** 124,128 **** q.appendScalarSelectTokens( pathExpressionParser.getWhereColumns() ); q.addScalarType( pathExpressionParser.getWhereColumnType() ); ! q.addJoin( pathExpressionParser.getName(), pathExpressionParser.getWhereJoin() ); ready = false; --- 124,128 ---- q.appendScalarSelectTokens( pathExpressionParser.getWhereColumns() ); q.addScalarType( pathExpressionParser.getWhereColumnType() ); ! pathExpressionParser.addFromAssociation(q); ready = false; Index: SelectPathExpressionParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/SelectPathExpressionParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SelectPathExpressionParser.java 5 Jan 2003 02:11:21 -0000 1.3 --- SelectPathExpressionParser.java 28 Feb 2003 07:01:28 -0000 1.4 *************** *** 12,20 **** token(null, q); } - /*if ( isCollectionValued() ) { - //if ( !q.supportsScalars() ) throw new QueryException("Can't use collection valued property in SELECT: " + currentProperty); - column = collectionElementColumn; - type = collectionElementType; - }*/ super.end(q); } --- 12,15 ---- *************** *** 23,27 **** throw new QueryException("expecting .elements or .indices after collection path expression in select"); } - public String getSelectName() { --- 18,21 ---- Index: WhereParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/WhereParser.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** WhereParser.java 23 Feb 2003 07:22:11 -0000 1.6 --- WhereParser.java 28 Feb 2003 07:01:28 -0000 1.7 *************** *** 354,357 **** --- 354,358 ---- private void doPathExpression(String token, QueryTranslator q) throws QueryException { + q.unalias(token); StringTokenizer tokens = new StringTokenizer(token, ".", true); pathExpressionParser.start(q); *************** *** 383,387 **** private void doToken(String token, QueryTranslator q) throws QueryException { if ( q.isName( StringHelper.root(token) ) ) { //path expression ! doPathExpression(token, q); } else if ( token.startsWith(ParserHelper.HQL_VARIABLE_PREFIX) ) { //named query parameter --- 384,388 ---- private void doToken(String token, QueryTranslator q) throws QueryException { if ( q.isName( StringHelper.root(token) ) ) { //path expression ! doPathExpression( q.unalias(token), q); } else if ( token.startsWith(ParserHelper.HQL_VARIABLE_PREFIX) ) { //named query parameter |
From: <one...@us...> - 2003-02-28 07:01:31
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql In directory sc8-pr-cvs1:/tmp/cvs-serv27226/sf/hibernate/sql Added Files: QuerySelect.java Log Message: reworked HQL, adding support for AS syntax in FROM clause non-collection associations may now be aliased --- NEW FILE: QuerySelect.java --- package net.sf.hibernate.sql; import java.util.HashSet; import java.util.Iterator; import net.sf.hibernate.util.StringHelper; public class QuerySelect { private JoinFragment joins = new QueryJoinFragment(); private StringBuffer select = new StringBuffer(); private StringBuffer where = new StringBuffer(); private StringBuffer groupBy = new StringBuffer(); private StringBuffer orderBy = new StringBuffer(); private StringBuffer having = new StringBuffer(); private boolean distinct=false; private static final HashSet dontSpace = new HashSet(); static { //dontSpace.add("'"); dontSpace.add("."); dontSpace.add("+"); dontSpace.add("-"); dontSpace.add("/"); dontSpace.add("*"); dontSpace.add("<"); dontSpace.add(">"); dontSpace.add("="); dontSpace.add("#"); dontSpace.add("~"); dontSpace.add("|"); dontSpace.add("&"); dontSpace.add("<="); dontSpace.add(">="); dontSpace.add("=>"); dontSpace.add("=<"); dontSpace.add("!="); dontSpace.add("<>"); dontSpace.add("!#"); dontSpace.add("!~"); dontSpace.add("!<"); dontSpace.add("!>"); dontSpace.add(StringHelper.OPEN_PAREN); //for MySQL dontSpace.add(StringHelper.CLOSE_PAREN); } public JoinFragment getJoinFragment() { return joins; } public void addSelectFragmentString(String fragment) { if ( fragment.length()>0 && fragment.charAt(0)==',' ) fragment = fragment.substring(1); fragment = fragment.trim(); if ( fragment.length()>0 ) { if ( select.length()>0 ) select.append(StringHelper.COMMA_SPACE); select.append(fragment); } } public void addSelectColumn(String columnName, String alias) { addSelectFragmentString(columnName + ' ' + alias); } public void setDistinct(boolean distinct) { this.distinct = distinct; } public void setWhereTokens(Iterator tokens) { //if ( conjunctiveWhere.length()>0 ) conjunctiveWhere.append(" and "); appendTokens(where, tokens); } public void setGroupByTokens(Iterator tokens) { //if ( groupBy.length()>0 ) groupBy.append(" and "); appendTokens(groupBy, tokens); } public void setOrderByTokens(Iterator tokens) { //if ( orderBy.length()>0 ) orderBy.append(" and "); appendTokens(orderBy, tokens); } public void setHavingTokens(Iterator tokens) { //if ( having.length()>0 ) having.append(" and "); appendTokens(having, tokens); } public String toQueryString() { StringBuffer buf = new StringBuffer(50) .append("select "); if (distinct) buf.append("distinct "); buf.append(select) .append(" from") .append( joins.toFromFragmentString().substring(1) ); String part1 = joins.toWhereFragmentString().trim(); String part2 = where.toString().trim(); boolean hasPart1 = part1.length() > 0; boolean hasPart2 = part2.length() > 0; if (hasPart1 || hasPart2) buf.append(" where "); if (hasPart1) buf.append( part1.substring(4) ); if (hasPart2) { if (hasPart1) buf.append(" and ("); buf.append(part2); if (hasPart1) buf.append(")"); } if ( groupBy.length() > 0 ) buf.append(" group by ").append(groupBy); if ( having.length() > 0 ) buf.append(" having ").append(having); if ( orderBy.length() > 0 ) buf.append(" order by ").append(orderBy); return buf.toString(); } private void appendTokens(StringBuffer buf, Iterator iter) { boolean lastSpaceable=true; while ( iter.hasNext() ) { String token = (String) iter.next(); boolean spaceable = !dontSpace.contains(token); if (spaceable && lastSpaceable) buf.append(' '); lastSpaceable = spaceable; buf.append(token); } } } |
From: <one...@us...> - 2003-02-28 07:01:30
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg In directory sc8-pr-cvs1:/tmp/cvs-serv27226/sf/hibernate/cfg Modified Files: Environment.java Log Message: reworked HQL, adding support for AS syntax in FROM clause non-collection associations may now be aliased Index: Environment.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg/Environment.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Environment.java 22 Feb 2003 06:42:06 -0000 1.4 --- Environment.java 28 Feb 2003 07:01:27 -0000 1.5 *************** *** 38,42 **** public final class Environment { ! private static final String VERSION = "2.0 beta 3"; /** --- 38,42 ---- public final class Environment { ! private static final String VERSION = "2.0 beta 4"; /** |
From: <one...@us...> - 2003-02-26 13:28:53
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/helpers In directory sc8-pr-cvs1:/tmp/cvs-serv18365 Modified Files: ReflectHelper.java Log Message: fixed an npe Index: ReflectHelper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/helpers/ReflectHelper.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** ReflectHelper.java 27 Jan 2003 07:30:24 -0000 1.40 --- ReflectHelper.java 26 Feb 2003 13:28:50 -0000 1.41 *************** *** 151,155 **** private static Method setterMethod(Class theClass, String propertyName) { ! Class returnType = getGetterOrNull(theClass, propertyName).getReturnType(); Method[] methods = theClass.getDeclaredMethods(); --- 151,156 ---- private static Method setterMethod(Class theClass, String propertyName) { ! Getter getter = getGetterOrNull(theClass, propertyName); ! Class returnType = (getter==null) ? null : getter.getReturnType(); Method[] methods = theClass.getDeclaredMethods(); |
From: <one...@us...> - 2003-02-26 13:27:28
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/util In directory sc8-pr-cvs1:/tmp/cvs-serv17757 Modified Files: ReflectHelper.java Log Message: fixed an npe Index: ReflectHelper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/util/ReflectHelper.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ReflectHelper.java 15 Feb 2003 08:00:56 -0000 1.7 --- ReflectHelper.java 26 Feb 2003 13:27:25 -0000 1.8 *************** *** 155,159 **** private static Method setterMethod(Class theClass, String propertyName) { ! Class returnType = getGetterOrNull(theClass, propertyName).getReturnType(); Method[] methods = theClass.getDeclaredMethods(); --- 155,160 ---- private static Method setterMethod(Class theClass, String propertyName) { ! Getter getter = getGetterOrNull(theClass, propertyName); ! Class returnType = (getter==null) ? null : getter.getReturnType(); Method[] methods = theClass.getDeclaredMethods(); |
From: <one...@us...> - 2003-02-24 12:07:18
|
Update of /cvsroot/hibernate/Hibernate2/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14810 Modified Files: commons-beanutils.jar Log Message: latest beanutils Index: commons-beanutils.jar =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/lib/commons-beanutils.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsiYhsxG and /tmp/cvscRxNpe differ |
From: <one...@us...> - 2003-02-24 11:53:48
|
Update of /cvsroot/hibernate/Hibernate2 In directory sc8-pr-cvs1:/tmp/cvs-serv10031 Modified Files: changelog.txt build.xml Log Message: cleanups Index: changelog.txt =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/changelog.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** changelog.txt 19 Feb 2003 12:38:24 -0000 1.7 --- changelog.txt 24 Feb 2003 11:53:44 -0000 1.8 *************** *** 66,69 **** --- 66,70 ---- * huge improvements to CodeGenerator (Max Andersen) * enhanced outerjoin fetching support in queries + * experimental support for DynaBeans as components Changes in version 1.2.3 (28.1.2003) Index: build.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/build.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** build.xml 3 Feb 2003 12:20:29 -0000 1.6 --- build.xml 24 Feb 2003 11:53:44 -0000 1.7 *************** *** 17,20 **** --- 17,21 ---- <property name="Name" value="Hibernate"/> <property name="name" value="hibernate"/> + <property name="name2" value="hibernate2"/> <property name="version" value="2.0"/> *************** *** 131,135 **** <target name="jar" depends="compile" description="Build the distribution .jar file"> <mkdir dir="${dist.dir}"/> ! <jar jarfile="${dist.dir}/${name}.jar" basedir="${build.dir}"/> </target> --- 132,136 ---- <target name="jar" depends="compile" description="Build the distribution .jar file"> <mkdir dir="${dist.dir}"/> ! <jar jarfile="${dist.dir}/${name2}.jar" basedir="${build.dir}"/> </target> |
From: <one...@us...> - 2003-02-24 11:53:48
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv10031/src/net/sf/hibernate Modified Files: Session.java Log Message: cleanups Index: Session.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Session.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Session.java 14 Jan 2003 14:07:04 -0000 1.6 --- Session.java 24 Feb 2003 11:53:45 -0000 1.7 *************** *** 240,245 **** * will be thrown.<br> * <br> - * <em>The class may not contain toplevel collections or collections - * with subcollections.</em> * * @param object a transient instance containing updated state --- 240,243 ---- *************** *** 253,258 **** * current session.<br> * <br> - * <em>The class may not contain toplevel collections or collections - * with subcollections.</em> * * @param object a transient instance containing updated state --- 251,254 ---- |
From: <one...@us...> - 2003-02-24 11:53:48
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv10031/src/net/sf/hibernate/test Modified Files: FooBarTest.java Log Message: cleanups Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** FooBarTest.java 23 Feb 2003 13:47:18 -0000 1.27 --- FooBarTest.java 24 Feb 2003 11:53:44 -0000 1.28 *************** *** 241,244 **** --- 241,245 ---- s.find("select fum1.friends.elements from fum1 in class Fum"); s.find("from fum1 in class Fum, fr in elements( fum1.friends )"); + s.connection().commit(); s.close(); } *************** *** 648,651 **** --- 649,653 ---- assertTrue( h.getFooArray()[2]!=null); assertTrue( h.getFoos().size()==2 ); + s.connection().commit(); s.close(); *************** *** 2603,2606 **** --- 2605,2609 ---- assertTrue( l.getCity().equals("Melbourne") ); assertTrue( l.getLocale().equals( Locale.getDefault() ) ); + s.connection().commit(); s.close(); s = sessions.openSession(); |
From: <tu...@us...> - 2003-02-23 13:59:31
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference In directory sc8-pr-cvs1:/tmp/cvs-serv23208/doc/reference Modified Files: README Log Message: Updated for new XSL stylesheets Index: README =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/README,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** README 1 Jan 2003 13:42:59 -0000 1.1.1.1 --- README 23 Feb 2003 13:59:25 -0000 1.2 *************** *** 1,168 **** ! ############################################################################ ! # REQUIRED SOFTWARE # ! ############################################################################ ! ! Some packages are required to compile the HTML and PDF documentation. ! ! On RedHat Linux 7.3, install RPMs: ! ! rpm -i jadetex-3.12-2.noarch.rpm \ ! sgml-common-0.6.3-9.noarch.rpm \ ! tetex-1.0.7-47.i386.rpm \ ! tetex-latex-1.0.7-47.i386.rpm \ ! tetex-dvips-1.0.7-47.i386.rpm \ ! openjade-1.3.1-4.i386.rpm \ ! ed-0.2-25.i386.rpm \ ! tetex-fonts-1.0.7-47.i386.rpm \ ! docbook-dtds-1.0-8.noarch.rpm \ ! docbook-style-xsl-1.49-1.noarch.rpm \ ! docbook-style-dsssl-1.76-1.noarch.rpm ! ! Link the current DTD to the real version name: ! ! ln -s /usr/share/sgml/docbook/xml-dtd-4.1.2-1.0-8 \ ! /usr/share/sgml/docbook/xml-dtd-4.1.2 ! ! Converting the DocBook XML source to HTML requires an XSL Transformer. ! Don't use Xalan, it is broken with the current DocBook XSL stylesheets! ! ! We recommend using Saxon from http://saxon.sourceforge.net/ - the ! version in use is 6.5.2. Just move saxon.jar to your libs directory ! somewhere and change the path in the scripts. ! ! The PDF output uses TeX and then converts from TeX to PDF. This stuff is ! somewhat broken, as the DSSSL stylesheets change regulary and the whole ! DocBook toolchain is just a big mess. The configuration files are only ! tested with the package versions of the RPMs above! ! ! ! ! ############################################################################ ! # HTML DOCUMENTATION # ! ############################################################################ ! ! The following bash script can be used to generate the HTML documentation ! (set the path to saxon.jar): ! ! -------------------------- dbtrans2html ------------------------------------ ! #!/bin/bash ! ! SAXON=~/dev/lib/saxon.jar; ! XSL_PARAMS="html.stylesheet=../style.css \ ! chunk.section.depth='5' \ ! use.id.as.filename='1'"; ! ! USAGE="usage: dbtrans2html INFILE.xml STYLE.XSL OUTFILE.html|OUTDIR" ! ! if [[ -z "$1" || -z "$2" || -z "$3" ]]; then ! echo $USAGE ! echo ! exit ! fi ! ! if [ ! -r $1 ]; then ! echo $USAGE ! echo File $1 not found or not readable. ! echo ! exit ! fi ! ! echo "Generating HTML with Saxon from XML source: $1" ! ! CLASSPATH=$JAVA_HOME/lib/tools.jar:$SAXON; ! ! CURRDIR=$PWD; ! if [ -d $3 ]; then ! cd $3; ! java -cp $CLASSPATH com.icl.saxon.StyleSheet $1 $2 $XSL_PARAMS ! cd $CURRDIR; ! else ! java -cp $CLASSPATH com.icl.saxon.StyleSheet -o $3 $1 $2 $XSL_PARAMS ! fi ! ! echo "Finished." ! ---------------------------------------------------------------------------- ! ! Calling the script (use absolute path names!): ! ! dbtrans2html ~/Hibernate/doc/reference/src/index.xml \ ! /usr/share/sgml/docbook/xsl-stylesheets/html/docbook.xsl \ ! ~/Hibernate/doc/reference/html_single/index.html ! ! To generate the chunked online HTML documentation, change the XSL file and ! use an existing directory as the OUTFILE parameter: ! ! dbtrans2html ~/Hibernate/doc/reference/src/index.xml \ ! /usr/share/sgml/docbook/xsl-stylesheets/html/chunk.xsl \ ! ~/Hibernate/doc/reference/html/ ! ! ! ! ############################################################################ ! # PDF DOCUMENTATION # ! ############################################################################ ! ! The following bash script can be used to generate the PDF documentation ! (set the path to xml.dcl): ! ! -------------------------- dbtrans2pdf ------------------------------------- ! #!/bin/bash ! ! XMLDCL="/usr/share/doc/openjade-1.3.1/pubtext/xml.dcl"; ! ! USAGE="usage: dbtrans2pdf INFILE.xml OUTFILE.pdf /path/to/hibernate.dsl" ! ! if [[ -z "$1" || -z "$2" ]]; then ! echo $USAGE ! echo ! exit ! fi ! ! if [ ! -r $1 ]; then ! echo $USAGE ! echo File \"$1\" not found or not readable. ! echo ! exit ! fi ! ! # Generate LaTeX from XML source ! echo "Generating TeX from XML source: $1" ! TEMPFILE=`date +%s`; ! ! jade -d $3 -t tex -o $TEMPFILE.tex $XMLDCL $1 ! RETVAL=$? ! ! if [ $RETVAL -eq 0 ] ; then ! ! echo "Generating PDF..." ! # This is really broken, but required for references and TOC... ! # min. 3 times: ! pdfjadetex $TEMPFILE.tex 2&>/dev/null ! pdfjadetex $TEMPFILE.tex 2&>/dev/null ! pdfjadetex $TEMPFILE.tex 2&>/dev/null ! ! # Final Move ! mv $TEMPFILE.pdf $2 ! ! echo "Cleanup..." ! # Cleanup ! rm $TEMPFILE.* ! echo "Finished." ! else ! echo "ERROR: jadetex failed." ! rm $TEMPFILE.tex 2&>/dev/null ! fi ! ---------------------------------------------------------------------------- ! Calling the script (use absolute path names!): ! dbtrans2pdf ~/Hibernate/doc/reference/src/index.xml \ ! ~/Hibernate/doc/reference/pdf/hibernate_reference.pdf \ ! ~/Hibernate/doc/reference/hibernate.dsl ! ! The script hides the STDERR of pdfjadetex (lots of debugging output) by ! default. If something goes wrong in this step, you won't see it. If ! something is broken in the XML, the jade step will spit out errors earlier, ! though. ! ! \ No newline at end of file --- 1,8 ---- ! We're using the DocBook XSL distribution for HTML and PDF ! generation. The best results can be achieved with the ! Saxon XSLT processor (don't use Xalan!) and the Apache ! FOP library. ! See the scripts in the bin/ directory for more information. ! chr...@bl... |
From: <one...@us...> - 2003-02-23 13:57:09
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect In directory sc8-pr-cvs1:/tmp/cvs-serv21655 Added Files: SybaseAnywhereDialect.java Log Message: sybase anywhere support contributed by Lorenzo --- NEW FILE: SybaseAnywhereDialect.java --- package net.sf.hibernate.dialect; /** * SQL Dialect for Sybase Anywhere * Extending Sybase (Enterprise) Dialect * (Tested on ASA 8.x) */ public class SybaseAnywhereDialect extends SybaseDialect { /** * Sybase Anywhere syntax would require a "DEFAULT" for each column specified, * but I suppose Hibernate use this syntax only with tables with just 1 column */ public String getNoColumnsInsertString() { //return "DEFAULT VALUES"; return "VALUES (DEFAULT)"; } /** * ASA does not require to drop constraint before dropping tables, and DROP statement * syntax used by Hibernate to drop constraint is not compatible with ASA, so disable it */ public boolean dropConstraints() { return false; } } |
From: <one...@us...> - 2003-02-23 13:55:20
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/sql In directory sc8-pr-cvs1:/tmp/cvs-serv20582 Added Files: SybaseAnywhereDialect.java Log Message: sybase anywhere support contributed by Lorenzo --- NEW FILE: SybaseAnywhereDialect.java --- package cirrus.hibernate.sql; /** * SQL Dialect for Sybase Anywhere * Extending Sybase (Enterprise) Dialect * (Tested on ASA 8.x) */ public class SybaseAnywhereDialect extends SybaseDialect { /** * Sybase Anywhere syntax would require a "DEFAULT" for each column specified, * but I suppose Hibernate use this syntax only with tables with just 1 column */ public String getNoColumnsInsertString() { //return "DEFAULT VALUES"; return "VALUES (DEFAULT)"; } /** * ASA does not require to drop constraint before dropping tables, and DROP statement * syntax used by Hibernate to drop constraint is not compatible with ASA, so disable it */ public boolean dropConstraints() { return false; } } |
From: <tu...@us...> - 2003-02-23 13:54:41
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference In directory sc8-pr-cvs1:/tmp/cvs-serv20125/doc/reference Modified Files: style.css Log Message: Updated for new XSL stylesheets Index: style.css =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/style.css,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** style.css 1 Jan 2003 13:42:59 -0000 1.1.1.1 --- style.css 23 Feb 2003 13:54:38 -0000 1.2 *************** *** 31,34 **** --- 31,45 ---- } + TABLE { + border-collapse: collapse; + border-spacing:0; + border: 1px thin black; + empty-cells: hide; + } + + TD { + padding: 4pt; + } + H1 { font-size: 150%; } H2 { font-size: 140%; } *************** *** 45,49 **** PRE { ! font-size: 90%; padding: 5px; border-style: solid; --- 56,60 ---- PRE { ! font-size: 100%; padding: 5px; border-style: solid; *************** *** 84,86 **** ! \ No newline at end of file --- 95,97 ---- ! |
From: <tu...@us...> - 2003-02-23 13:54:02
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference In directory sc8-pr-cvs1:/tmp/cvs-serv19557/doc/reference Removed Files: hibernate.dsl jadetex.cfg Log Message: No longer needed --- hibernate.dsl DELETED --- --- jadetex.cfg DELETED --- |
From: <tu...@us...> - 2003-02-23 13:53:28
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/src In directory sc8-pr-cvs1:/tmp/cvs-serv19045/doc/reference/src Modified Files: advanced_or_mapping.xml architecture.xml basic_or_mapping.xml best_practices.xml examples.xml index.xml manipulating_data.xml persistent_classes.xml query_language.xml session_configuration.xml transactions.xml Log Message: Updated for new XSL stylesheets Index: advanced_or_mapping.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/advanced_or_mapping.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** advanced_or_mapping.xml 28 Jan 2003 13:25:10 -0000 1.9 --- advanced_or_mapping.xml 23 Feb 2003 13:53:24 -0000 1.10 *************** *** 115,122 **** </para> ! <programlisting><![CDATA[<map name="propertyName" table="table_name" ! schema="schema_name lazy="true|false" inverse="true|false" --- 115,133 ---- </para> ! <programlistingco> ! <areaspec> ! <area id="mappingcollection1" coords="2 50"/> ! <area id="mappingcollection2" coords="3 50"/> ! <area id="mappingcollection3" coords="4 50"/> ! <area id="mappingcollection4" coords="5 50"/> ! <area id="mappingcollection5" coords="6 50"/> ! <area id="mappingcollection6" coords="7 50"/> ! <area id="mappingcollection7" coords="8 50"/> ! <area id="mappingcollection8" coords="9 50"/> ! </areaspec> ! <programlisting><![CDATA[<map name="propertyName" table="table_name" ! schema="schema_name" lazy="true|false" inverse="true|false" *************** *** 129,184 **** <element .... /> </map>]]></programlisting> ! ! <itemizedlist> ! <listitem> ! <para> ! <literal>name</literal> the collection property name ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>table</literal> (optional - defaults to property name) the ! name of the collection table (not used for one-to-many associations) ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>schema</literal> (optional) the name of a table schema to ! override the schema declared on the root element ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>lazy</literal> (optional - defaults to <literal>false</literal>) ! enable lazy initialization (not used for arrays) ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>inverse</literal> (optional - defaults to <literal>false</literal>) ! mark this collection as the "inverse" end of a bidirectional association ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>cascade</literal> (optional - defaults to <literal>none</literal>) ! enable operations to cascade to child entities (not used for toplevel ! collections) ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>sort</literal> (optional) specify a sorted collection with ! <literal>natural</literal> sort order, or a given comparator class ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>order-by</literal> (optional, JDK1.4 only) specify a table column (or columns) ! that define the iteration order of the <literal>Map</literal>, <literal>Set</literal> ! or bag, together with an optional <literal>asc</literal> or <literal>desc</literal>. ! </para> ! </listitem> ! </itemizedlist> </sect2> --- 140,196 ---- <element .... /> </map>]]></programlisting> ! <calloutlist> ! <callout arearefs="mappingcollection1"> ! <para> ! <literal>name</literal> the collection property name ! </para> ! </callout> ! <callout arearefs="mappingcollection2"> ! <para> ! <literal>table</literal> (optional - defaults to property name) the ! name of the collection table (not used for one-to-many associations) ! </para> ! </callout> ! <callout arearefs="mappingcollection3"> ! <para> ! <literal>schema</literal> (optional) the name of a table schema to ! override the schema declared on the root element ! </para> ! </callout> ! <callout arearefs="mappingcollection4"> ! <para> ! <literal>lazy</literal> (optional - defaults to <literal>false</literal>) ! enable lazy initialization (not used for arrays) ! </para> ! </callout> ! <callout arearefs="mappingcollection5"> ! <para> ! <literal>inverse</literal> (optional - defaults to <literal>false</literal>) ! mark this collection as the "inverse" end of a bidirectional association ! </para> ! </callout> ! <callout arearefs="mappingcollection6"> ! <para> ! <literal>cascade</literal> (optional - defaults to <literal>none</literal>) ! enable operations to cascade to child entities (not used for toplevel ! collections) ! </para> ! </callout> ! <callout arearefs="mappingcollection7"> ! <para> ! <literal>sort</literal> (optional) specify a sorted collection with ! <literal>natural</literal> sort order, or a given comparator class ! </para> ! </callout> ! <callout arearefs="mappingcollection8"> ! <para> ! <literal>order-by</literal> (optional, JDK1.4 only) specify a table column (or columns) ! that define the iteration order of the <literal>Map</literal>, <literal>Set</literal> ! or bag, together with an optional <literal>asc</literal> or <literal>desc</literal>. ! </para> ! </callout> ! </calloutlist> ! </programlistingco> ! </sect2> *************** *** 270,274 **** </para> ! <itemizedlist> <listitem> <para> --- 282,286 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 330,334 **** <programlisting><![CDATA[s = sessions.openSession(); ! User u = (User)s.find("from user in illflow.User where user.Name=?", userName, Hibernate.STRING).get(0); Map permissions = u.getPermissions(); s.connection().commit(); --- 342,348 ---- <programlisting><![CDATA[s = sessions.openSession(); ! User u = (User)s.find("from user in illflow.User where user.Name=?", ! userName, ! Hibernate.STRING).get(0); Map permissions = u.getPermissions(); s.connection().commit(); *************** *** 417,441 **** "ends" of the association. Two kinds of bidirectional association are supported: - </para> - - <variablelist> - <varlistentry> - <term>one-to-many</term> - <listitem> - <para> - Set valued at one end, single-valued at the other - </para> - </listitem> - </varlistentry> - <varlistentry> - <term>many-to-many</term> - <listitem> - <para> - Set / bag valued at both ends - </para> - </listitem> - </varlistentry> - </variablelist> <para> You may specify a bidirectional many-to-many association simply by mapping two --- 431,456 ---- "ends" of the association. Two kinds of bidirectional association are supported: + <variablelist> + <varlistentry> + <term>one-to-many</term> + <listitem> + <para> + Set valued at one end, single-valued at the other + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>many-to-many</term> + <listitem> + <para> + Set/bag valued at both ends + </para> + </listitem> + </varlistentry> + </variablelist> + + </para> + <para> You may specify a bidirectional many-to-many association simply by mapping two *************** *** 452,456 **** <many-to-many class="eg.Node" column="from_node_id"/> </bag> ! <bag name="accessibleFrom" table="node_access" inverse="true" lazy="true"> <!-- inverse end --> <key column="from_node_id"/> <many-to-many class="eg.Node" column="to_node_id"/> --- 467,472 ---- <many-to-many class="eg.Node" column="from_node_id"/> </bag> ! <!-- inverse end --> ! <bag name="accessibleFrom" table="node_access" inverse="true" lazy="true"> <key column="from_node_id"/> <many-to-many class="eg.Node" column="to_node_id"/> *************** *** 773,777 **** <property name="price"/> <property name="quantity"/> ! <many-to-one name="item" class="eg.Item/> <!--class attribute is optional--> </composite-element> </set> --- 789,793 ---- <property name="price"/> <property name="quantity"/> ! <many-to-one name="item" class="eg.Item"/> <!-- class attribute is optional --> </composite-element> </set> *************** *** 786,790 **** <composite-element class="eg.OrderLine"> <many-to-one name="purchaseDetails class="eg.Purchase"/> ! <many-to-one name="item" class="eg.Item/> </composite-element> </set> --- 802,806 ---- <composite-element class="eg.OrderLine"> <many-to-one name="purchaseDetails class="eg.Purchase"/> ! <many-to-one name="item" class="eg.Item"/> </composite-element> </set> *************** *** 814,818 **** </para> ! <itemizedlist> <listitem> <para> --- 830,834 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 952,967 **** </para> - <programlisting><![CDATA[<jcs-cache usage="read-write|read-only"/>]]></programlisting> - - <itemizedlist> - <listitem> - <para> - <literal>usage</literal> specifies the caching strategy - (<literal>read-write</literal>, - <literal>read-only</literal>) - </para> - </listitem> - </itemizedlist> </sect2> --- 968,987 ---- </para> + <programlistingco> + <areaspec> + <area id="cache1" coords="1 40"/> + </areaspec> + <programlisting><![CDATA[<jcs-cache usage="read-write|read-only" />]]></programlisting> + <calloutlist> + <callout arearefs="cache1"> + <para> + <literal>usage</literal> specifies the caching strategy + (<literal>read-write</literal>, + <literal>read-only</literal>) + </para> + </callout> + </calloutlist> + </programlistingco> </sect2> *************** *** 1053,1059 **** </para> ! <programlisting><![CDATA[Cat cat = (Cat) session.load(Cat.class, id); //instantiate a proxy (does not hit the db) ! if ( cat.isDomesticCat() ) { //hit the db to initialize the proxy ! DomesticCat dc = (DomesticCat) cat; // Error! .... }]]></programlisting> --- 1073,1079 ---- </para> ! <programlisting><![CDATA[Cat cat = (Cat) session.load(Cat.class, id); // instantiate a proxy (does not hit the db) ! if ( cat.isDomesticCat() ) { // hit the db to initialize the proxy ! DomesticCat dc = (DomesticCat) cat; // Error! .... }]]></programlisting> *************** *** 1063,1069 **** </para> ! <programlisting><![CDATA[Cat cat = (Cat) session.load(Cat.class, id); //instantiate a Cat proxy ! DomesticCat dc = (DomesticCat) session.load(DomesticCat.class, id); //must instantiate a new DomesticCat proxy! ! System.out.println(cat==dc); //false]]></programlisting> <para> --- 1083,1091 ---- </para> ! <programlisting><![CDATA[ ! Cat cat = (Cat) session.load(Cat.class, id); // instantiate a Cat proxy ! DomesticCat dc = ! (DomesticCat) session.load(DomesticCat.class, id); // required new DomesticCat proxy! ! System.out.println(cat==dc); // false]]></programlisting> <para> *************** *** 1072,1077 **** </para> ! <programlisting><![CDATA[cat.setWeight(11.0); //hit the db to initialize the proxy ! System.out.println( dc.getWeight() ); //11.0]]></programlisting> <para> --- 1094,1099 ---- </para> ! <programlisting><![CDATA[cat.setWeight(11.0); // hit the db to initialize the proxy ! System.out.println( dc.getWeight() ); // 11.0]]></programlisting> <para> *************** *** 1115,1119 **** </para> ! <itemizedlist> <listitem> <para> --- 1137,1141 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> Index: architecture.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/architecture.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** architecture.xml 1 Jan 2003 13:46:23 -0000 1.1.1.1 --- architecture.xml 23 Feb 2003 13:53:24 -0000 1.2 *************** *** 5,9 **** <sect1 id="architecture-s1"> <title>Overview</title> ! <para> A (very) high-level view of the Hibernate architecture: --- 5,9 ---- <sect1 id="architecture-s1"> <title>Overview</title> ! <para> A (very) high-level view of the Hibernate architecture: *************** *** 11,18 **** <mediaobject> ! <imageobject> ! <imagedata fileref="images/overview.pdf" format="EPS" align="center"/> </imageobject> ! <imageobject> <imagedata fileref="../images/overview.gif" format="GIF" align="center"/> </imageobject> --- 11,18 ---- <mediaobject> ! <imageobject role="fo"> ! <imagedata fileref="images/overview.svg" format="SVG" align="center"/> </imageobject> ! <imageobject role="html"> <imagedata fileref="../images/overview.gif" format="GIF" align="center"/> </imageobject> *************** *** 33,40 **** <mediaobject> ! <imageobject> ! <imagedata fileref="images/lite.pdf" format="EPS" align="center"/> </imageobject> ! <imageobject> <imagedata fileref="../images/lite.gif" format="GIF" align="center"/> </imageobject> --- 33,40 ---- <mediaobject> ! <imageobject role="fo"> ! <imagedata fileref="images/lite.svg" format="SVG" align="center"/> </imageobject> ! <imageobject role="html"> <imagedata fileref="../images/lite.gif" format="GIF" align="center"/> </imageobject> *************** *** 47,54 **** <mediaobject> ! <imageobject> ! <imagedata fileref="images/full_cream.pdf" format="EPS" align="center"/> </imageobject> ! <imageobject> <imagedata fileref="../images/full_cream.gif" format="GIF" align="center"/> </imageobject> --- 47,54 ---- <mediaobject> ! <imageobject role="fo"> ! <imagedata fileref="images/full_cream.svg" format="SVG" align="center"/> </imageobject> ! <imageobject role="html"> <imagedata fileref="../images/full_cream.gif" format="GIF" align="center"/> </imageobject> *************** *** 57,174 **** <para> Heres some definitions of the objects in the diagrams: - </para> - - <itemizedlist> - <listitem> - <para> - <literal>net.sf.hibernate.SessionFactory</literal> - </para> - </listitem> - <listitem> - <para> - <literal>net.sf.hibernate.Session</literal> - </para> - </listitem> - <listitem> - <para> - <literal>net.sf.hibernate.Transaction</literal> - </para> - </listitem> - <listitem> - <para> - <literal>net.sf.hibernate.TransactionFactory</literal> - </para> - </listitem> - <listitem> - <para> - <literal>net.sf.hibernate.connection.ConnectionProvider</literal> - </para> - </listitem> - <listitem> - <para> - persistent objects and collections - </para> - </listitem> - <listitem> - <para> - transient objects and collections - </para> - </listitem> - </itemizedlist> ! <variablelist> ! <varlistentry> ! <term>SessionFactory</term> ! <listitem> ! <para> ! A threadsafe (immutable) cache of compiled mappings. A factory for ! <literal>Session</literal>. A client of <literal>ConnectionProvider</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>Session</term> ! <listitem> ! <para> ! A single-threaded, short-lived object representing a conversation between ! the application and the persistent store. Wraps a JDBC connection. Factory ! for <literal>Transaction</literal>. Manages persistent objects to the ! application. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>Persistent Objects and Collections</term> ! <listitem> ! <para> ! Short-lived, single threaded objects containing persistent state and business ! function. These might be ordinary JavaBeans, the only special thing about them ! is that they are currently associated with (exactly one) ! <literal>Session</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>Transient Objects and Collections</term> ! <listitem> ! <para> ! Instances of persistent classes that are not currently associated with a ! <literal>Session</literal>. They may have been instantiated by ! the application and not (yet) persisted or they may have been instantiated by a ! closed <literal>Session</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>Transaction</term> ! <listitem> ! <para> ! ( Optional ) A single-threaded, short-lived object used by the application to ! specify atomic units of work. Abstracts application from underlying JDBC, ! JTA or CORBA transaction. A <literal>Session</literal> might span several ! <literal>Transaction</literal>s. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>ConnectionProvider</term> ! <listitem> ! <para> ! ( Optional ) A factory for JDBC connections. Abstracts application from ! underlying <literal>Datasource</literal> or <literal>DriverManager</literal>. ! Not exposed to application. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>TransactionFactory</term> ! <listitem> ! <para> ! ( Optional ) A factory for <literal>Transaction</literal>. Not exposed to the ! application. ! </para> ! </listitem> ! </varlistentry> ! </variablelist> <para> --- 57,136 ---- <para> Heres some definitions of the objects in the diagrams: ! <variablelist spacing="compact"> ! <varlistentry> ! <term>SessionFactory (<literal>net.sf.hibernate.SessionFactory</literal>)</term> ! <listitem> ! <para> ! A threadsafe (immutable) cache of compiled mappings. A factory for ! <literal>Session</literal>. A client of <literal>ConnectionProvider</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>Session (<literal>net.sf.hibernate.Session</literal>)</term> ! <listitem> ! <para> ! A single-threaded, short-lived object representing a conversation between ! the application and the persistent store. Wraps a JDBC connection. Factory ! for <literal>Transaction</literal>. Manages persistent objects to the ! application. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>Persistent Objects and Collections</term> ! <listitem> ! <para> ! Short-lived, single threaded objects containing persistent state and business ! function. These might be ordinary JavaBeans, the only special thing about them ! is that they are currently associated with (exactly one) ! <literal>Session</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>Transient Objects and Collections</term> ! <listitem> ! <para> ! Instances of persistent classes that are not currently associated with a ! <literal>Session</literal>. They may have been instantiated by ! the application and not (yet) persisted or they may have been instantiated by a ! closed <literal>Session</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>Transaction (<literal>net.sf.hibernate.Transaction</literal>)</term> ! <listitem> ! <para> ! (Optional) A single-threaded, short-lived object used by the application to ! specify atomic units of work. Abstracts application from underlying JDBC, ! JTA or CORBA transaction. A <literal>Session</literal> might span several ! <literal>Transaction</literal>s. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>ConnectionProvider (<literal>net.sf.hibernate.connection.ConnectionProvider</literal>)</term> ! <listitem> ! <para> ! (Optional) A factory for JDBC connections. Abstracts application from ! underlying <literal>Datasource</literal> or <literal>DriverManager</literal>. ! Not exposed to application. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>TransactionFactory (<literal>net.sf.hibernate.TransactionFactory</literal>)</term> ! <listitem> ! <para> ! (Optional) A factory for <literal>Transaction</literal>. Not exposed to the ! application. ! </para> ! </listitem> ! </varlistentry> ! </variablelist> ! </para> <para> *************** *** 189,202 **** </para> ! <simplelist type="horiz" columns="2"> ! <member>Persistent Identity</member> ! <member> ! <literal>foo.getId().equals( bar.getId() )</literal> ! </member> ! <member>JVM Identity</member> ! <member> ! <literal>foo==bar</literal> ! </member> ! </simplelist> <para> --- 151,172 ---- </para> ! <variablelist spacing="compact"> ! <varlistentry> ! <term>Persistent Identity</term> ! <listitem> ! <para> ! <literal>foo.getId().equals( bar.getId() )</literal> ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term>JVM Identity</term> ! <listitem> ! <para> ! <literal>foo==bar</literal> ! </para> ! </listitem> ! </varlistentry> ! </variablelist> <para> Index: basic_or_mapping.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/basic_or_mapping.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** basic_or_mapping.xml 16 Feb 2003 04:09:28 -0000 1.8 --- basic_or_mapping.xml 23 Feb 2003 13:53:24 -0000 1.9 *************** *** 85,91 **** <para> ! You may declare a persistent class using </para> ! <programlisting><![CDATA[<class name="ClassName" table="tableName" --- 85,104 ---- <para> [...1528 lines suppressed...] ! to a basic type or implement <literal>PersistentEnum</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>clob, blob</literal></term> ! <listitem> ! <para> ! Type mappings for the JDBC classes <literal>java.sql.Clob</literal> and ! <literal>java.sql.Blob</literal>. These types may be inconvenient for some ! applications, since the blob or clob object may not be reused outside of ! a transaction. (Furthermore, driver support is patchy and inconsistent.) ! </para> ! </listitem> ! </varlistentry> ! </variablelist> ! ! </para> <para> Index: best_practices.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/best_practices.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** best_practices.xml 1 Jan 2003 13:46:28 -0000 1.1.1.1 --- best_practices.xml 23 Feb 2003 13:53:24 -0000 1.2 *************** *** 3,7 **** <title>Best Practices</title> ! <variablelist> <varlistentry> <term>Write fine-grained classes and map them using <literal><component></literal> --- 3,7 ---- <title>Best Practices</title> ! <variablelist spacing="compact"> <varlistentry> <term>Write fine-grained classes and map them using <literal><component></literal> Index: examples.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/examples.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** examples.xml 16 Jan 2003 08:39:24 -0000 1.3 --- examples.xml 23 Feb 2003 13:53:24 -0000 1.4 *************** *** 4,8 **** <sect1 id="examples-s0"> ! <title>Employer / Employee</title> <para> --- 4,8 ---- <sect1 id="examples-s0"> ! <title>Employer/Employee</title> <para> *************** *** 15,19 **** <mediaobject> ! <imageobject> <imagedata fileref="../images/EmployerEmployee.gif" format="GIF" align="center"/> </imageobject> --- 15,22 ---- <mediaobject> ! <imageobject role="fo"> ! <imagedata fileref="images/EmployerEmployee.gif" format="GIF" align="center"/> ! </imageobject> ! <imageobject role="html"> <imagedata fileref="../images/EmployerEmployee.gif" format="GIF" align="center"/> </imageobject> *************** *** 103,108 **** ) ! alter table employment_periods add constraint employment_periodsFK0 foreign key (employer_id) references employers ! alter table employment_periods add constraint employment_periodsFK1 foreign key (employee_id) references employees create sequence employee_id_seq create sequence employment_id_seq --- 106,113 ---- ) ! alter table employment_periods ! add constraint employment_periodsFK0 foreign key (employer_id) references employers ! alter table employment_periods ! add constraint employment_periodsFK1 foreign key (employee_id) references employees create sequence employee_id_seq create sequence employment_id_seq *************** *** 112,116 **** <sect1 id="examples-s1"> ! <title>Author / Work</title> <para> --- 117,121 ---- <sect1 id="examples-s1"> ! <title>Author/Work</title> <para> *************** *** 124,128 **** <mediaobject> ! <imageobject> <imagedata fileref="../images/AuthorWork.gif" format="GIF" align="center"/> </imageobject> --- 129,136 ---- <mediaobject> ! <imageobject role="fo"> ! <imagedata fileref="images/AuthorWork.gif" format="GIF" align="center"/> ! </imageobject> ! <imageobject role="html"> <imagedata fileref="../images/AuthorWork.gif" format="GIF" align="center"/> </imageobject> *************** *** 162,166 **** <id name="id" column="id"> ! <generator class="assigned"/> <!-- The Author must have the same identifier as the Person --> </id> --- 170,175 ---- <id name="id" column="id"> ! <!-- The Author must have the same identifier as the Person --> ! <generator class="assigned"/> </id> *************** *** 220,231 **** ) ! alter table authors add constraint authorsFK0 foreign key (id) references persons ! alter table author_work add constraint author_workFK0 foreign key (author_id) references authors ! alter table author_work add constraint author_workFK1 foreign key (work_id) references works]]></programlisting> </sect1> <sect1 id="examples-s2"> ! <title>Customer / Order / Product</title> <para> --- 229,243 ---- ) ! alter table authors ! add constraint authorsFK0 foreign key (id) references persons ! alter table author_work ! add constraint author_workFK0 foreign key (author_id) references authors ! alter table author_work ! add constraint author_workFK1 foreign key (work_id) references works]]></programlisting> </sect1> <sect1 id="examples-s2"> ! <title>Customer/Order/Product</title> <para> *************** *** 241,246 **** <mediaobject> ! <imageobject> ! <imagedata fileref="../images/CustomerOrderProduct.gif" format="GIF" align="center"/> </imageobject> </mediaobject> --- 253,261 ---- <mediaobject> ! <imageobject role="fo"> ! <imagedata fileref="images/AuthorWork.gif" format="GIF" align="center"/> ! </imageobject> ! <imageobject role="html"> ! <imagedata fileref="../images/AuthorWork.gif" format="GIF" align="center"/> </imageobject> </mediaobject> *************** *** 322,328 **** ) ! alter table orders add constraint ordersFK0 foreign key (customer_id) references customers ! alter table line_items add constraint line_itemsFK0 foreign key (product_id) references products ! alter table line_items add constraint line_itemsFK1 foreign key (order_id) references orders]]></programlisting> </sect1> --- 337,346 ---- ) ! alter table orders ! add constraint ordersFK0 foreign key (customer_id) references customers ! alter table line_items ! add constraint line_itemsFK0 foreign key (product_id) references products ! alter table line_items ! add constraint line_itemsFK1 foreign key (order_id) references orders]]></programlisting> </sect1> Index: index.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/index.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.xml 28 Jan 2003 13:25:11 -0000 1.2 --- index.xml 23 Feb 2003 13:53:24 -0000 1.3 *************** *** 1,3 **** ! <?xml version='1.0'?> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "/usr/share/sgml/docbook/xml-dtd-4.1.2/docbookx.dtd" --- 1,3 ---- ! <?xml version='1.0' encoding="iso-8859-1"?> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "/usr/share/sgml/docbook/xml-dtd-4.1.2/docbookx.dtd" *************** *** 13,33 **** <!ENTITY examples SYSTEM "examples.xml"> <!ENTITY best-practices SYSTEM "best_practices.xml"> - ]> <book> <bookinfo> ! <title>Hibernate Reference Documentation</title> ! <subtitle>Relational Persistence for Idiomatic Java</subtitle> ! <subtitle>http://hibernate.sourceforge.net/</subtitle> ! <subtitle>Version: 2.0 beta1</subtitle> ! <date>28.01.2003</date> </bookinfo> ! &architecture; ! &session_config; ! &persistent-classes; --- 13,33 ---- <!ENTITY examples SYSTEM "examples.xml"> <!ENTITY best-practices SYSTEM "best_practices.xml"> ]> + <book> <bookinfo> ! <title>HIBERNATE - Relational Persistence for Idiomatic Java</title> ! <subtitle>Reference Documentation</subtitle> ! <releaseinfo>2.0 beta2</releaseinfo> </bookinfo> ! ! <toc/> ! &architecture; ! &session_config; ! &persistent-classes; *************** *** 37,49 **** &manipulating-data; ! &query-language; &transactions; ! &examples; &best-practices; - </book> --- 37,48 ---- &manipulating-data; ! &query-language; &transactions; ! &examples; &best-practices; </book> Index: manipulating_data.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/manipulating_data.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** manipulating_data.xml 16 Jan 2003 20:55:25 -0000 1.2 --- manipulating_data.xml 23 Feb 2003 13:53:24 -0000 1.3 *************** *** 141,147 **** </para> ! <programlisting><![CDATA[Iterator iter = sess.iterate("from q in class eg.Qux order by q.likeliness"); //fetch ids while ( iter.hasNext() ) { ! Qux qux = (Qux) iter.next(); //fetch the object // something we couldnt express in the query if ( qux.calculateComplicatedAlgorithm() ) { --- 141,148 ---- </para> ! <programlisting><![CDATA[// fetch ids ! Iterator iter = sess.iterate("from q in class eg.Qux order by q.likeliness"); while ( iter.hasNext() ) { ! Qux qux = (Qux) iter.next(); // fetch the object // something we couldnt express in the query if ( qux.calculateComplicatedAlgorithm() ) { *************** *** 169,175 **** </para> ! <programlisting><![CDATA[Iterator iter = sess.iterate( ! "select customer, product from customer in class Customer, product in class Product, " + ! "purchase in customer.purchases where product = purchase.product" );]]></programlisting> --- 170,179 ---- </para> ! <programlisting><![CDATA[ ! Iterator iter = sess.iterate( ! "select customer, product from customer in class Customer, " + ! "product in class Product, " + ! "purchase in customer.purchases " + ! "where product = purchase.product" );]]></programlisting> *************** *** 205,210 **** <programlisting><![CDATA[Iterator results = sess.iterate( ! "select cat.color, min(cat.birthdate), count(cat) from cat in class eg.Cat" + ! "group by cat.color" ); while ( results.hasNext() ) { --- 209,214 ---- <programlisting><![CDATA[Iterator results = sess.iterate( ! "select cat.color, min(cat.birthdate), count(cat) from cat in class eg.Cat " + ! "group by cat.color" ); while ( results.hasNext() ) { *************** *** 267,271 **** </para> ! <itemizedlist> <listitem> <para> --- 271,275 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 297,312 **** <sect2 id="manipulating-data-s5b"> ! <title>Scrollable iteration</title> ! <para> ! If your JDBC driver supports scrollable <literal>ResultSet</literal>s, the <literal>Query</literal> ! interface may be used to obtain a <literal>ScrollableResults</literal> which allows more flexible ! navigation of the query results. ! </para> ! <programlisting><![CDATA[Query q = sess.createQuery("select cat.name, cat from cat in class eg.DomesticCat order by cat.name"); ScrollableResults cats = q.scroll(); if ( cats.first() ) { ! //find the first name on each page of an alphabetical list of cats by name firstNamesOfPages = new ArrayList(); do { --- 301,317 ---- <sect2 id="manipulating-data-s5b"> ! <title>Scrollable iteration</title> ! <para> ! If your JDBC driver supports scrollable <literal>ResultSet</literal>s, the <literal>Query</literal> ! interface may be used to obtain a <literal>ScrollableResults</literal> which allows more flexible ! navigation of the query results. ! </para> ! <programlisting><![CDATA[Query q = sess.createQuery("select cat.name, cat from cat in class eg.DomesticCat " + ! "order by cat.name"); ScrollableResults cats = q.scroll(); if ( cats.first() ) { ! // find the first name on each page of an alphabetical list of cats by name firstNamesOfPages = new ArrayList(); do { *************** *** 316,320 **** while ( cats.scroll(PAGE_SIZE) ); ! //Now get the first page of cats pageOfCats = new ArrayList(); cats.beforeFirst(); --- 321,325 ---- while ( cats.scroll(PAGE_SIZE) ); ! // Now get the first page of cats pageOfCats = new ArrayList(); cats.beforeFirst(); *************** *** 334,342 **** <sect2 id="manipulating-data-s6"> <title>Filtering collections</title> ! <para> ! A collection <emphasis>filter</emphasis> is a special type of query that may be applied to ! a persistent collection (but not an array). The query string may refer to <literal>this</literal>, ! meaning the current collection element. ! </para> <programlisting><![CDATA[Collection blackKittens = session.filter( --- 339,347 ---- <sect2 id="manipulating-data-s6"> <title>Filtering collections</title> ! <para> ! A collection <emphasis>filter</emphasis> is a special type of query that may be applied to ! a persistent collection (but not an array). The query string may refer to <literal>this</literal>, ! meaning the current collection element. ! </para> <programlisting><![CDATA[Collection blackKittens = session.filter( *************** *** 344,355 **** )]]></programlisting> ! <para> ! The returned collection is considered a bag. ! </para> ! <para> ! Observe that filters do not require a <literal>from</literal> clause (though they may have ! one if required). Filters are not limited to returning the collection elements themselves. ! </para> <programlisting><![CDATA[Collection blackKittenMates = session.filter( --- 349,360 ---- )]]></programlisting> ! <para> ! The returned collection is considered a bag. ! </para> ! <para> ! Observe that filters do not require a <literal>from</literal> clause (though they may have ! one if required). Filters are not limited to returning the collection elements themselves. ! </para> <programlisting><![CDATA[Collection blackKittenMates = session.filter( *************** *** 376,380 **** <programlisting><![CDATA[DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) ); cat.setName("PK"); ! sess.flush(); //changes to cat are automatically detected and persisted]]></programlisting> <para> --- 381,385 ---- <programlisting><![CDATA[DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) ); cat.setName("PK"); ! sess.flush(); // changes to cat are automatically detected and persisted]]></programlisting> <para> *************** *** 408,412 **** // later, in a new session ! secondSession.update(cat, catID); // update cat secondSession.update(mate, mateID); // update mate]]></programlisting> --- 413,417 ---- // later, in a new session ! secondSession.update(cat, catID); // update cat secondSession.update(mate, mateID); // update mate]]></programlisting> *************** *** 446,470 **** </para> ! <itemizedlist> ! <listitem> ! <para> ! <literal>any</literal> - always save (this is the default!) ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>none</literal> - always update ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>null</literal> - save when identifier is null ! </para> ! </listitem> ! <listitem> ! <para> ! valid identifier value - save when identifier is null or the given value ! </para> ! </listitem> </itemizedlist> --- 451,475 ---- </para> ! <itemizedlist spacing="compact"> ! <listitem> ! <para> ! <literal>any</literal> - always save (this is the default!) ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>none</literal> - always update ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>null</literal> - save when identifier is null ! </para> ! </listitem> ! <listitem> ! <para> ! valid identifier value - save when identifier is null or the given value ! </para> ! </listitem> </itemizedlist> *************** *** 477,482 **** // later, in a new session ! secondSession.saveOrUpdate(cat); // update existing state (cat has a non-null id) ! secondSession.saveOrUpdate(mate); // save the new instance (mate has a null id)]]></programlisting> </sect1> --- 482,487 ---- // later, in a new session ! secondSession.saveOrUpdate(cat); // update existing state (cat has a non-null id) ! secondSession.saveOrUpdate(mate); // save the new instance (mate has a null id)]]></programlisting> </sect1> *************** *** 514,518 **** </para> ! <itemizedlist> <listitem> <para> --- 519,523 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 533,537 **** </para> ! <itemizedlist> <listitem> <para> --- 538,542 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 551,555 **** </para> ! <itemizedlist> <listitem> <para> --- 556,560 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 582,586 **** </para> ! <itemizedlist> <listitem> <para> --- 587,591 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 644,648 **** </para> ! <itemizedlist> <listitem> <para> --- 649,653 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 666,670 **** </para> ! <orderedlist> <listitem> <para> --- 671,675 ---- </para> ! <orderedlist spacing="compact"> <listitem> <para> *************** *** 734,738 **** </para> ! <itemizedlist> <listitem> <para> --- 739,743 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 785,789 **** <programlisting><![CDATA[sess.flush(); ! sess.connection().commit(); //not necessary for JTA datasource]]></programlisting> <para> --- 790,794 ---- <programlisting><![CDATA[sess.flush(); ! sess.connection().commit(); // not necessary for JTA datasource]]></programlisting> <para> *************** *** 791,795 **** </para> ! <programlisting><![CDATA[tx.rollback(); // rollback the transaction]]></programlisting> <para> --- 796,800 ---- </para> ! <programlisting><![CDATA[tx.rollback(); // rollback the transaction]]></programlisting> <para> *************** *** 797,801 **** </para> ! <programlisting><![CDATA[//not necessary for JTA datasource, important otherwise sess.connection().rollback();]]></programlisting> --- 802,806 ---- </para> ! <programlisting><![CDATA[// not necessary for JTA datasource, important otherwise sess.connection().rollback();]]></programlisting> *************** *** 814,818 **** <programlisting><![CDATA[sess.flush(); ! sess.connection().commit(); //not necessary for JTA datasource sess.close();]]></programlisting> --- 819,823 ---- <programlisting><![CDATA[sess.flush(); ! sess.connection().commit(); // not necessary for JTA datasource sess.close();]]></programlisting> *************** *** 846,850 **** try { tx = sess.beginTransaction(); ! //do some work ... tx.commit(); --- 851,855 ---- try { tx = sess.beginTransaction(); ! // do some work ... tx.commit(); *************** *** 864,868 **** <programlisting><![CDATA[Session sess = factory.openSession(); try { ! //do some work ... sess.flush(); --- 869,873 ---- <programlisting><![CDATA[Session sess = factory.openSession(); try { ! // do some work ... sess.flush(); *************** *** 884,888 **** Session sess = factory.openSession(); try { ! //do some work ... sess.flush(); --- 889,893 ---- Session sess = factory.openSession(); try { ! // do some work ... sess.flush(); *************** *** 923,973 **** public class AuditInterceptor implements Interceptor, Serializable { - - private int updates; - private int creates; ! public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { ! } ! public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) { ! ! if ( entity instanceof Auditable ) { ! updates++; ! for ( int i=0; i<propertyNames.length; i++ ) { ! if ( "lastUpdateTimestamp".equals( propertyNames[i] ) ) { ! currentState[i] = new Date(); ! return true; ! } ! } ! } ! return false; ! } ! public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { ! return false; ! } ! public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { ! if ( entity instanceof Auditable ) { ! creates++; ! for ( int i=0; i<propertyNames.length; i++ ) { ! if ( "createTimestamp".equals( propertyNames[i] ) ) { ! state[i] = new Date(); ! return true; ! } ! } ! } ! return false; ! } ! public void postFlush(Iterator entities) { ! System.out.println("Creations: " + creates + ", Updates: " + updates); ! } ! public void preFlush(Iterator entities) { ! updates=0; ! creates=0; ! } }]]></programlisting> --- 928,996 ---- public class AuditInterceptor implements Interceptor, Serializable { ! private int updates; ! private int creates; ! public void onDelete(Object entity, ! Serializable id, ! Object[] state, ! String[] propertyNames, ! Type[] types) { ! // do nothing ! } ! public boolean onFlushDirty(Object entity, ! Serializable id, ! Object[] currentState, ! Object[] previousState, ! String[] propertyNames, ! Type[] types) { ! if ( entity instanceof Auditable ) { ! updates++; ! for ( int i=0; i < propertyNames.length; i++; ) { ! if ( "lastUpdateTimestamp".equals( propertyNames[i] ) ) { ! currentState[i] = new Date(); ! return true; ! } ! } ! } ! return false; ! } ! public boolean onLoad(Object entity, ! Serializable id, ! Object[] state, ! String[] propertyNames, ! Type[] types) { ! return false; ! } ! public boolean onSave(Object entity, ! Serializable id, ! Object[] state, ! String[] propertyNames, ! Type[] types) { ! ! if ( entity instanceof Auditable ) { ! creates++; ! for ( int i=0; i<propertyNames.length; i++ ) { ! if ( "createTimestamp".equals( propertyNames[i] ) ) { ! state[i] = new Date(); ! return true; ! } ! } ! } ! return false; ! } ! ! public void postFlush(Iterator entities) { ! System.out.println("Creations: " + creates + ", Updates: " + updates); ! } + public void preFlush(Iterator entities) { + updates=0; + creates=0; + } }]]></programlisting> Index: persistent_classes.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/persistent_classes.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** persistent_classes.xml 1 Jan 2003 13:46:32 -0000 1.1.1.1 --- persistent_classes.xml 23 Feb 2003 13:53:24 -0000 1.2 *************** *** 22,74 **** private char sex; private float weight; ! private void setId(long id) { ! this.id=id; } public long getId() { ! return id; } ! void setMate(Cat mate) { ! this.mate = mate; } public Cat getMate() { ! return mate; } ! void setBirthdate(Date date) { ! birthdate = date; } public Date getBirthdate() { ! return birthdate; } void setWeight(float weight) { ! this.weight = weight; } public float getWeight() { ! return weight; } public Color getColor() { ! return color; } void setColor(Color color) { ! this.color = color; } void setKittens(Set kittens) { ! this.kittens = kittens; } public Set getKittens() { ! return kittens; } // addKitten not needed by Hibernate public void addKitten(Cat kitten) { ! kittens.add(kitten); } void setSex(char sex) { ! this.sex=sex; } public char getSex() { ! return sex; } }]]></programlisting> --- 22,74 ---- private char sex; private float weight; ! private void setId(long id) { ! this.id=id; } public long getId() { ! return id; } ! void setMate(Cat mate) { ! this.mate = mate; } public Cat getMate() { ! return mate; } ! void setBirthdate(Date date) { ! birthdate = date; } public Date getBirthdate() { ! return birthdate; } void setWeight(float weight) { ! this.weight = weight; } public float getWeight() { ! return weight; } public Color getColor() { ! return color; } void setColor(Color color) { ! this.color = color; } void setKittens(Set kittens) { ! this.kittens = kittens; } public Set getKittens() { ! return kittens; } // addKitten not needed by Hibernate public void addKitten(Cat kitten) { ! kittens.add(kitten); } void setSex(char sex) { ! this.sex=sex; } public char getSex() { ! return sex; } }]]></programlisting> *************** *** 131,135 **** </para> ! <itemizedlist> <listitem> <para> --- 131,135 ---- </para> ! <itemizedlist spacing="compact"> <listitem> <para> *************** *** 182,189 **** <para> ! Optionally, a persistent class might implement the interface </para> ! <programlisting><![CDATA[public interface Lifecycle { public boolean onSave(Session s) throws CallbackException; public boolean onUpdate(Session s) throws CallbackException; --- 182,199 ---- <para> ! Optionally, a persistent class might implement the interface ! <literal>Lifecycle</literal> which provides some callbacks that allow ! the persistent object to perform necessary initialization/cleanup after ! save or load and before deletion or update. </para> ! <programlistingco> ! <areaspec> ! <area id="lifecycle1" coords="2 70"/> ! <area id="lifecycle2" coords="3 70" /> ! <area id="lifecycle3" coords="4 70"/> ! <area id="lifecycle4" c... [truncated message content] |
From: <tu...@us...> - 2003-02-23 13:52:30
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/src/xsl In directory sc8-pr-cvs1:/tmp/cvs-serv18582/doc/reference/src/xsl Added Files: fopdf.xsl html_chunk.xsl html.xsl Log Message: New XSL stylesheets --- NEW FILE: fopdf.xsl --- <?xml version="1.0"?> <!-- This is the XSL FO configuration file for the Hibernate Reference Documentation. It defines a custom titlepage and the parameters for the A4 sized PDF printable output. It took me days to figure out this stuff and fix most of the obvious bugs in the DocBook XSL distribution, so if you use this stylesheet, give some credit back to the Hibernate project. chr...@bl... --> <!DOCTYPE xsl:stylesheet [ <!ENTITY db_xsl_path "/usr/share/sgml/docbook/xsl-stylesheets"> <!ENTITY admon_gfx_path "/usr/share/sgml/docbook/xsl-stylesheets/images/"> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/TR/xhtml1/transitional" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="#default"> <xsl:import href="&db_xsl_path;/fo/docbook.xsl"/> <!--################################################### Custom Title Page ################################################### --> <xsl:template name="book.titlepage.recto"> <fo:block> <fo:table table-layout="fixed" width="175mm"> <fo:table-column column-width="175mm"/> <fo:table-body> <fo:table-row> <fo:table-cell text-align="center"> <fo:block> <fo:external-graphic src="file:images/hibernate_logo_a.png"/> </fo:block> <fo:block font-family="Helvetica" font-size="22pt" padding-before="10mm"> <xsl:value-of select="bookinfo/subtitle"/> </fo:block> <fo:block font-family="Helvetica" font-size="12pt" padding="10mm"> Version: <xsl:value-of select="bookinfo/releaseinfo"/> </fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </fo:block> </xsl:template> <!-- Prevent blank pages in output --> <xsl:template name="book.titlepage.before.verso"> </xsl:template> <xsl:template name="book.titlepage.verso"> </xsl:template> <xsl:template name="book.titlepage.separator"> </xsl:template> <!--################################################### Custom Footer ################################################### --> <!-- This footer prints the Hibernate version number on the left side --> <xsl:template name="footer.content"> <xsl:param name="pageclass" select="''"/> <xsl:param name="sequence" select="''"/> <xsl:param name="position" select="''"/> <xsl:param name="gentext-key" select="''"/> <xsl:variable name="Version"> <xsl:choose> <xsl:when test="//releaseinfo"> <xsl:text>Hibernate </xsl:text><xsl:value-of select="//releaseinfo"/> </xsl:when> <xsl:otherwise> <!-- nop --> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:choose> <xsl:when test="$sequence='blank'"> <xsl:choose> <xsl:when test="$double.sided != 0 and $position = 'left'"> <xsl:value-of select="$Version"/> </xsl:when> <xsl:when test="$double.sided = 0 and $position = 'center'"> <!-- nop --> </xsl:when> <xsl:otherwise> <fo:page-number/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="$pageclass='titlepage'"> <!-- nop: other titlepage sequences have no footer --> </xsl:when> <xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='left'"> <fo:page-number/> </xsl:when> <xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='right'"> <fo:page-number/> </xsl:when> <xsl:when test="$double.sided = 0 and $position='right'"> <fo:page-number/> </xsl:when> <xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='left'"> <xsl:value-of select="$Version"/> </xsl:when> <xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='right'"> <xsl:value-of select="$Version"/> </xsl:when> <xsl:when test="$double.sided = 0 and $position='left'"> <xsl:value-of select="$Version"/> </xsl:when> <xsl:otherwise> <!-- nop --> </xsl:otherwise> </xsl:choose> </xsl:template> <!--################################################### Custom Toc Line ################################################### --> <!-- The default DocBook XSL TOC printing is seriously broken... --> <xsl:template name="toc.line"> <xsl:variable name="id"> <xsl:call-template name="object.id"/> </xsl:variable> <xsl:variable name="label"> <xsl:apply-templates select="." mode="label.markup"/> </xsl:variable> <!-- justify-end removed from block attributes (space problem in title.markup) --> <fo:block end-indent="{$toc.indent.width}pt" last-line-end-indent="-{$toc.indent.width}pt" white-space-treatment="preserve" white-space-collapse="false"> <fo:inline keep-with-next.within-line="always"> <!-- print Chapters in bold style --> <xsl:choose> <xsl:when test="local-name(.) = 'chapter'"> <xsl:attribute name="font-weight">bold</xsl:attribute> </xsl:when> </xsl:choose> <fo:basic-link internal-destination="{$id}"> <xsl:if test="$label != ''"> <xsl:copy-of select="$label"/> <fo:inline white-space-treatment="preserve" white-space-collapse="false"> <xsl:value-of select="$autotoc.label.separator"/> </fo:inline> </xsl:if> <xsl:apply-templates select="." mode="title.markup"/> </fo:basic-link> </fo:inline> <fo:inline keep-together.within-line="always"> <xsl:text> </xsl:text> <fo:leader leader-pattern="dots" leader-pattern-width="3pt" leader-alignment="reference-area" keep-with-next.within-line="always"/> <xsl:text> </xsl:text> <fo:basic-link internal-destination="{$id}"> <fo:page-number-citation ref-id="{$id}"/> </fo:basic-link> </fo:inline> </fo:block> </xsl:template> <!--################################################### Extensions ################################################### --> <!-- These extensions are required for table printing and other stuff --> <xsl:param name="use.extensions">1</xsl:param> <xsl:param name="tablecolumns.extension">0</xsl:param> <xsl:param name="callout.extensions">1</xsl:param> <!-- FOP provide only PDF Bookmarks at the moment --> <xsl:param name="fop.extensions">1</xsl:param> <!--################################################### Table Of Contents ################################################### --> <!-- Generate the TOCs for named components only --> <xsl:param name="generate.toc"> book toc </xsl:param> <!-- Show only Sections up to level 3 in the TOCs --> <xsl:param name="toc.section.depth">3</xsl:param> <!-- Dot and Whitespace as separator in TOC between Label and Title--> <xsl:param name="autotoc.label.separator" select="'. '"/> <!--################################################### Paper & Page Size ################################################### --> <!-- Paper type, no headers on blank pages, no double sided printing --> <xsl:param name="paper.type" select="'A4'"/> <xsl:param name="double.sided">0</xsl:param> <xsl:param name="headers.on.blank.pages">0</xsl:param> <xsl:param name="footers.on.blank.pages">0</xsl:param> <!-- Space between paper border and content (chaotic stuff, don't touch) --> <xsl:param name="page.margin.top">5mm</xsl:param> <xsl:param name="region.before.extent">10mm</xsl:param> <xsl:param name="body.margin.top">15mm</xsl:param> <xsl:param name="body.margin.bottom">15mm</xsl:param> <xsl:param name="region.after.extent">10mm</xsl:param> <xsl:param name="page.margin.bottom">0mm</xsl:param> <xsl:param name="page.margin.outer">18mm</xsl:param> <xsl:param name="page.margin.inner">18mm</xsl:param> <!-- No intendation of Titles --> <xsl:param name="title.margin.left">0pc</xsl:param> <!--################################################### Fonts & Styles ################################################### --> <!-- Default Font size --> <xsl:param name="body.font.master">11</xsl:param> <!-- Line height in body text --> <xsl:param name="line-height">1.4</xsl:param> <!-- Monospaced fonts are smaller than regular text --> <xsl:attribute-set name="monospace.properties"> <xsl:attribute name="font-family"> <xsl:value-of select="$monospace.font.family"/> </xsl:attribute> <xsl:attribute name="font-size">0.8em</xsl:attribute> </xsl:attribute-set> <!--################################################### Tables ################################################### --> <!-- The table width should be adapted to the paper size --> <xsl:param name="default.table.width">17.4cm</xsl:param> <!-- Some padding inside tables --> <xsl:attribute-set name="table.cell.padding"> <xsl:attribute name="padding-left">4pt</xsl:attribute> <xsl:attribute name="padding-right">4pt</xsl:attribute> <xsl:attribute name="padding-top">4pt</xsl:attribute> <xsl:attribute name="padding-bottom">4pt</xsl:attribute> </xsl:attribute-set> <!-- Only hairlines as frame and cell borders in tables --> <xsl:param name="table.frame.border.thickness">0.1pt</xsl:param> <xsl:param name="table.cell.border.thickness">0.1pt</xsl:param> <!--################################################### Labels ################################################### --> <!-- Label Chapters and Sections (numbering) --> <xsl:param name="chapter.autolabel">1</xsl:param> <xsl:param name="section.autolabel" select="1"/> <xsl:param name="section.label.includes.component.label" select="1"/> <!--################################################### Titles ################################################### --> <!-- Chapter title size --> <xsl:attribute-set name="chapter.titlepage.recto.style"> <xsl:attribute name="text-align">left</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="font-size"> <xsl:value-of select="$body.font.master * 1.8"/> <xsl:text>pt</xsl:text> </xsl:attribute> </xsl:attribute-set> <!-- Why is the font-size for chapters hardcoded in the XSL FO templates? Let's remove it, so this sucker can use our attribute-set only... --> <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode"> <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="chapter.titlepage.recto.style"> <xsl:call-template name="component.title"> <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/> </xsl:call-template> </fo:block> </xsl:template> <!-- Sections 1, 2 and 3 titles have a small bump factor and padding --> <xsl:attribute-set name="section.title.level1.properties"> <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute> <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute> <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute> <xsl:attribute name="font-size"> <xsl:value-of select="$body.font.master * 1.5"/> <xsl:text>pt</xsl:text> </xsl:attribute> <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="section.title.level2.properties"> <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute> <xsl:attribute name="space-before.minimum">0.6em</xsl:attribute> <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute> <xsl:attribute name="font-size"> <xsl:value-of select="$body.font.master * 1.25"/> <xsl:text>pt</xsl:text> </xsl:attribute> <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="section.title.level3.properties"> <xsl:attribute name="space-before.optimum">0.4em</xsl:attribute> <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute> <xsl:attribute name="space-before.maximum">0.4em</xsl:attribute> <xsl:attribute name="font-size"> <xsl:value-of select="$body.font.master * 1.0"/> <xsl:text>pt</xsl:text> </xsl:attribute> <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute> </xsl:attribute-set> <!-- Titles of formal objects (tables, examples, ...) --> <xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing"> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="font-size"> <xsl:value-of select="$body.font.master"/> <xsl:text>pt</xsl:text> </xsl:attribute> <xsl:attribute name="hyphenate">false</xsl:attribute> <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute> <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute> <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute> </xsl:attribute-set> <!--################################################### Programlistings ################################################### --> <!-- Verbatim text formatting (programlistings) --> <xsl:attribute-set name="verbatim.properties"> <xsl:attribute name="space-before.minimum">1em</xsl:attribute> <xsl:attribute name="space-before.optimum">1em</xsl:attribute> <xsl:attribute name="space-before.maximum">1em</xsl:attribute> <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute> <xsl:attribute name="border-color">#444444</xsl:attribute> <xsl:attribute name="border-style">solid</xsl:attribute> <xsl:attribute name="border-width">0.1pt</xsl:attribute> <xsl:attribute name="padding-top">0.5em</xsl:attribute> <xsl:attribute name="padding-left">0.5em</xsl:attribute> <xsl:attribute name="padding-right">0.5em</xsl:attribute> <xsl:attribute name="padding-bottom">0.5em</xsl:attribute> <xsl:attribute name="margin-left">0.5em</xsl:attribute> <xsl:attribute name="margin-right">0.5em</xsl:attribute> </xsl:attribute-set> <!-- Shade (background) programlistings --> <xsl:param name="shade.verbatim">1</xsl:param> <xsl:attribute-set name="shade.verbatim.style"> <xsl:attribute name="background-color">#F0F0F0</xsl:attribute> </xsl:attribute-set> <!--################################################### Callouts ################################################### --> <!-- Use images for callouts instead of (1) (2) (3) --> <xsl:param name="callout.graphics">0</xsl:param> <xsl:param name="callout.unicode">1</xsl:param> <!-- Place callout marks at this column in annotated areas --> <xsl:param name="callout.defaultcolumn">90</xsl:param> <!--################################################### Admonitions ################################################### --> <!-- Use nice graphics for admonitions --> <xsl:param name="admon.graphics">'1'</xsl:param> <xsl:param name="admon.graphics.path">&admon_gfx_path;</xsl:param> <!--################################################### Misc ################################################### --> <!-- Placement of titles --> <xsl:param name="formal.title.placement"> figure after example before equation before table before procedure before </xsl:param> <!-- Format Variable Lists as Blocks (prevents horizontal overflow) --> <xsl:param name="variablelist.as.blocks">1</xsl:param> <!-- The horrible list spacing problems --> <xsl:attribute-set name="list.block.spacing"> <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute> <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute> <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute> <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute> <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute> </xsl:attribute-set> </xsl:stylesheet> --- NEW FILE: html_chunk.xsl --- <?xml version="1.0"?> <!-- This is the XSL HTML configuration file for the Hibernate Reference Documentation. It took me days to figure out this stuff and fix most of the obvious bugs in the DocBook XSL distribution, so if you use this stylesheet, give some credit back to the Hibernate project. chr...@bl... --> <!DOCTYPE xsl:stylesheet [ <!ENTITY db_xsl_path "/usr/share/sgml/docbook/xsl-stylesheets"> <!ENTITY callout_gfx_path "../images/callouts/"> <!ENTITY admon_gfx_path "../images/admons/"> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/TR/xhtml1/transitional" exclude-result-prefixes="#default"> <xsl:import href="&db_xsl_path;/html/chunk.xsl"/> <!--################################################### HTML Settings ################################################### --> <xsl:param name="chunk.section.depth">'5'</xsl:param> <xsl:param name="use.id.as.filename">'1'</xsl:param> <xsl:param name="html.stylesheet">../style.css</xsl:param> <!-- These extensions are required for table printing and other stuff --> <xsl:param name="use.extensions">1</xsl:param> <xsl:param name="tablecolumns.extension">0</xsl:param> <xsl:param name="callout.extensions">1</xsl:param> <xsl:param name="graphicsize.extension">0</xsl:param> <!--################################################### Table Of Contents ################################################### --> <!-- Generate the TOCs for named components only --> <xsl:param name="generate.toc"> book toc </xsl:param> <!-- Show only Sections up to level 3 in the TOCs --> <xsl:param name="toc.section.depth">3</xsl:param> <!--################################################### Labels ################################################### --> <!-- Label Chapters and Sections (numbering) --> <xsl:param name="chapter.autolabel">1</xsl:param> <xsl:param name="section.autolabel" select="1"/> <xsl:param name="section.label.includes.component.label" select="1"/> <!--################################################### Callouts ################################################### --> <!-- Use images for callouts instead of (1) (2) (3) --> <xsl:param name="callout.graphics">1</xsl:param> <xsl:param name="callout.graphics.path">&callout_gfx_path;</xsl:param> <!-- Place callout marks at this column in annotated areas --> <xsl:param name="callout.defaultcolumn">90</xsl:param> <!--################################################### Admonitions ################################################### --> <!-- Use nice graphics for admonitions --> <xsl:param name="admon.graphics">'1'</xsl:param> <xsl:param name="admon.graphics.path">&admon_gfx_path;</xsl:param> <!--################################################### Misc ################################################### --> <!-- Placement of titles --> <xsl:param name="formal.title.placement"> figure after example before equation before table before procedure before </xsl:param> </xsl:stylesheet> --- NEW FILE: html.xsl --- <?xml version="1.0"?> <!-- This is the XSL HTML configuration file for the Hibernate Reference Documentation. It took me days to figure out this stuff and fix most of the obvious bugs in the DocBook XSL distribution, so if you use this stylesheet, give some credit back to the Hibernate project. chr...@bl... --> <!DOCTYPE xsl:stylesheet [ <!ENTITY db_xsl_path "/usr/share/sgml/docbook/xsl-stylesheets"> <!ENTITY callout_gfx_path "../images/callouts/"> <!ENTITY admon_gfx_path "../images/admons/"> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/TR/xhtml1/transitional" exclude-result-prefixes="#default"> <xsl:import href="&db_xsl_path;/html/docbook.xsl"/> <!--################################################### HTML Settings ################################################### --> <xsl:param name="html.stylesheet">../style.css</xsl:param> <!-- These extensions are required for table printing and other stuff --> <xsl:param name="use.extensions">1</xsl:param> <xsl:param name="tablecolumns.extension">0</xsl:param> <xsl:param name="callout.extensions">1</xsl:param> <xsl:param name="graphicsize.extension">0</xsl:param> <!--################################################### Table Of Contents ################################################### --> <!-- Generate the TOCs for named components only --> <xsl:param name="generate.toc"> book toc </xsl:param> <!-- Show only Sections up to level 3 in the TOCs --> <xsl:param name="toc.section.depth">3</xsl:param> <!--################################################### Labels ################################################### --> <!-- Label Chapters and Sections (numbering) --> <xsl:param name="chapter.autolabel">1</xsl:param> <xsl:param name="section.autolabel" select="1"/> <xsl:param name="section.label.includes.component.label" select="1"/> <!--################################################### Callouts ################################################### --> <!-- Use images for callouts instead of (1) (2) (3) --> <xsl:param name="callout.graphics">1</xsl:param> <xsl:param name="callout.graphics.path">&callout_gfx_path;</xsl:param> <!-- Place callout marks at this column in annotated areas --> <xsl:param name="callout.defaultcolumn">90</xsl:param> <!--################################################### Admonitions ################################################### --> <!-- Use nice graphics for admonitions --> <xsl:param name="admon.graphics">'1'</xsl:param> <xsl:param name="admon.graphics.path">&admon_gfx_path;</xsl:param> <!--################################################### Misc ################################################### --> <!-- Placement of titles --> <xsl:param name="formal.title.placement"> figure after example before equation before table before procedure before </xsl:param> </xsl:stylesheet> |
From: <tu...@us...> - 2003-02-23 13:51:55
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/src/xsl In directory sc8-pr-cvs1:/tmp/cvs-serv18206/doc/reference/src/xsl Log Message: Directory /cvsroot/hibernate/Hibernate2/doc/reference/src/xsl added to the repository |
From: <tu...@us...> - 2003-02-23 13:51:45
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/src/images In directory sc8-pr-cvs1:/tmp/cvs-serv18108/doc/reference/src/images Removed Files: full_cream.sxd lite.sxd overview.sxd README Log Message: No longer needed --- full_cream.sxd DELETED --- --- lite.sxd DELETED --- --- overview.sxd DELETED --- --- README DELETED --- |