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
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/id Modified Files: Assigned.java HexGenerator.java HiLoGenerator.java HiLoHexGenerator.java IdentifierGenerationException.java IdentifierGenerator.java LongGenerator.java NativeGenerator.java PersistentIdentifierGenerator.java SequenceGenerator.java SequenceHiLoGenerator.java UUIDGenerator.java UUIDHexGenerator.java UUIDStringGenerator.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: Assigned.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/Assigned.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Assigned.java 1 Jan 2003 13:54:39 -0000 1.1.1.1 --- Assigned.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 8,12 **** import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>assigned</b><br> * <br> --- 8,12 ---- import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>assigned</b><br> * <br> *************** *** 17,21 **** public static final Assigned INSTANCE = new Assigned(); ! public Serializable generate(SessionImplementor session, Object obj) throws HibernateException { if (obj instanceof PersistentCollection) throw new IdentifierGenerationException( --- 17,21 ---- public static final Assigned INSTANCE = new Assigned(); ! public Serializable generate(SessionImplementor session, Object obj) throws HibernateException { if (obj instanceof PersistentCollection) throw new IdentifierGenerationException( *************** *** 24,31 **** final Serializable id = session.getPersister(obj).getIdentifier(obj); if (id==null) throw new IdentifierGenerationException( ! "ids for this class must be manually assigned before calling save(): " + obj.getClass().getName() ); return id; } ! } --- 24,34 ---- final Serializable id = session.getPersister(obj).getIdentifier(obj); if (id==null) throw new IdentifierGenerationException( ! "ids for this class must be manually assigned before calling save(): " + obj.getClass().getName() ); return id; } ! } + + + Index: HexGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/HexGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HexGenerator.java 1 Jan 2003 13:54:39 -0000 1.1.1.1 --- HexGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,22 **** import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>vm.hex</b><br> * <br> ! * An <tt>IdentifierGenerator</tt> that returns a string of hexadecimal digits of ! * length 16, constructed from the system time and a counter value. Not safe * for use in a cluster! */ public class HexGenerator extends LongGenerator { ! public Serializable generate(SessionImplementor session, Object obj) { return Long.toHexString( ( (Long) super.generate(session, obj) ).longValue() ); } ! public static void main( String[] args ) throws Exception { IdentifierGenerator gen = new HexGenerator(); --- 6,22 ---- import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>vm.hex</b><br> * <br> ! * An <tt>IdentifierGenerator</tt> that returns a string of hexadecimal digits of ! * length 16, constructed from the system time and a counter value. Not safe * for use in a cluster! */ public class HexGenerator extends LongGenerator { ! public Serializable generate(SessionImplementor session, Object obj) { return Long.toHexString( ( (Long) super.generate(session, obj) ).longValue() ); } ! public static void main( String[] args ) throws Exception { IdentifierGenerator gen = new HexGenerator(); *************** *** 25,28 **** } } ! } --- 25,31 ---- } } ! } + + + Index: HiLoGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/HiLoGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HiLoGenerator.java 1 Jan 2003 13:54:39 -0000 1.1.1.1 --- HiLoGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 19,23 **** * <b>hilo.long</b><br> * <br> ! * An <tt>IdentifierGenerator</tt> that returns a <tt>Long</tt>, constructed using * a hi/lo algorithm. The hi value MUST be fetched in a seperate transaction * to the <tt>Session</tt> transaction so the generator must be able to obtain --- 19,23 ---- * <b>hilo.long</b><br> * <br> ! * An <tt>IdentifierGenerator</tt> that returns a <tt>Long</tt>, constructed using * a hi/lo algorithm. The hi value MUST be fetched in a seperate transaction * to the <tt>Session</tt> transaction so the generator must be able to obtain *************** *** 29,171 **** * <br> * Two mapping parameters are supported: tablename, columnname. ! * * @see SequenceHiLoGenerator */ public class HiLoGenerator implements PersistentIdentifierGenerator { ! ! private long hi; ! private short lo = Short.MAX_VALUE; ! private final String tableName; ! private final String columnName; ! private final String query; ! private final String update; ! ! private ConnectionProvider connections; ! ! private static final Log log = LogFactory.getLog(HiLoGenerator.class); ! ! public HiLoGenerator(String tableName, String columnName) { ! this.tableName = tableName; ! this.columnName = columnName; ! query = "select " + columnName + " from " + tableName; ! update = "update " + tableName + " set " + columnName + " = ? where " + columnName + " = ?"; ! } ! ! public HiLoGenerator() { ! this("hibernate_unique_key", "next_hi"); ! } ! ! public HiLoGenerator(String driverclass, String url, String username, String password) throws HibernateException { ! this(); ! connections = getConnectionProvider(driverclass, url, username, password); ! } ! ! public HiLoGenerator(String driverclass, String url, String username, String password, String tablename, String columnname) throws HibernateException { ! this(tablename, columnname); ! connections = getConnectionProvider(driverclass, url, username, password); ! } ! ! protected ConnectionProvider getConnectionProvider(String driverclass, String url, String username, String password) throws HibernateException { ! Properties props = new Properties(); ! props.put(Environment.DRIVER, driverclass); ! props.put(Environment.URL, url); ! props.put(Environment.USER, username); ! props.put(Environment.PASS, password); return ConnectionProviderFactory.newConnectionProvider(props); ! } ! ! public synchronized Serializable generate(SessionImplementor session, Object obj) throws SQLException { ! if (lo == Short.MAX_VALUE) { ! int rows; ! int hiInt; ! // This has to be done using a different connection to the ! // containing transaction because the new hi value must ! // remain valid even if the containing transaction rolls ! // back ! Connection conn; ! if (connections==null) { ! conn = session.getFactory().openConnection(); ! } ! else { ! conn = connections.getConnection(); ! } ! ! try { ! ! do { ! // The loop ensures atomicity of the ! // select + update even for no transaction ! // or read committed isolation level ! PreparedStatement qps = conn.prepareStatement(query); ! try { ! ResultSet rs = qps.executeQuery(); ! rs.next(); ! hiInt = rs.getInt(columnName); ! rs.close(); ! } ! catch (SQLException sqle) { ! log.error("could not read a hi value - may need to populate the table: " + tableName, sqle); ! throw sqle; ! } ! finally { ! qps.close(); ! } ! ! PreparedStatement ups = conn.prepareStatement(update); ! try { ! ups.setInt( 1, hiInt + 1 ); ! ups.setInt( 2, hiInt ); ! rows = ups.executeUpdate(); ! } ! catch (SQLException sqle) { ! log.error("could not update hi value in: " + tableName, sqle); ! throw sqle; ! } ! finally { ! ups.close(); ! } ! } ! while (rows==0); ! ! conn.commit(); ! ! lo = 0; ! hi = hiInt; ! ! } ! finally { ! ! if (connections==null) { ! session.getFactory().closeConnection(conn); ! } ! else { ! connections.closeConnection(conn); ! } ! ! } ! log.debug("New hi value: " + hi); ! } ! ! return new Long( ( hi << 16 ) + lo++ ); ! ! } ! ! ! public String[] sqlCreateStrings(Dialect dialect) throws HibernateException { ! return new String[] { ! "create table " + tableName + " ( " + columnName + " " + dialect.getTypeName(Types.INTEGER) + " )", ! "insert into " + tableName + " values ( 0 )" ! }; ! } - public String sqlDropString(Dialect dialect) { - return "drop table " + tableName; - } - public Object generatorKey() { - return tableName; - } - } --- 29,174 ---- * <br> * Two mapping parameters are supported: tablename, columnname. ! * * @see SequenceHiLoGenerator */ public class HiLoGenerator implements PersistentIdentifierGenerator { ! ! private long hi; ! private short lo = Short.MAX_VALUE; ! private final String tableName; ! private final String columnName; ! private final String query; ! private final String update; ! ! private ConnectionProvider connections; ! ! private static final Log log = LogFactory.getLog(HiLoGenerator.class); ! ! public HiLoGenerator(String tableName, String columnName) { ! this.tableName = tableName; ! this.columnName = columnName; ! query = "select " + columnName + " from " + tableName; ! update = "update " + tableName + " set " + columnName + " = ? where " + columnName + " = ?"; ! } ! ! public HiLoGenerator() { ! this("hibernate_unique_key", "next_hi"); ! } ! ! public HiLoGenerator(String driverclass, String url, String username, String password) throws HibernateException { ! this(); ! connections = getConnectionProvider(driverclass, url, username, password); ! } ! ! public HiLoGenerator(String driverclass, String url, String username, String password, String tablename, String columnname) throws HibernateException { ! this(tablename, columnname); ! connections = getConnectionProvider(driverclass, url, username, password); ! } ! ! protected ConnectionProvider getConnectionProvider(String driverclass, String url, String username, String password) throws HibernateException { ! Properties props = new Properties(); ! props.put(Environment.DRIVER, driverclass); ! props.put(Environment.URL, url); ! props.put(Environment.USER, username); ! props.put(Environment.PASS, password); return ConnectionProviderFactory.newConnectionProvider(props); ! } ! ! public synchronized Serializable generate(SessionImplementor session, Object obj) throws SQLException { ! if (lo == Short.MAX_VALUE) { ! int rows; ! int hiInt; ! // This has to be done using a different connection to the ! // containing transaction because the new hi value must ! // remain valid even if the containing transaction rolls ! // back ! Connection conn; ! if (connections==null) { ! conn = session.getFactory().openConnection(); ! } ! else { ! conn = connections.getConnection(); ! } ! ! try { ! ! do { ! // The loop ensures atomicity of the ! // select + update even for no transaction ! // or read committed isolation level ! PreparedStatement qps = conn.prepareStatement(query); ! try { ! ResultSet rs = qps.executeQuery(); ! rs.next(); ! hiInt = rs.getInt(columnName); ! rs.close(); ! } ! catch (SQLException sqle) { ! log.error("could not read a hi value - may need to populate the table: " + tableName, sqle); ! throw sqle; ! } ! finally { ! qps.close(); ! } ! ! PreparedStatement ups = conn.prepareStatement(update); ! try { ! ups.setInt( 1, hiInt + 1 ); ! ups.setInt( 2, hiInt ); ! rows = ups.executeUpdate(); ! } ! catch (SQLException sqle) { ! log.error("could not update hi value in: " + tableName, sqle); ! throw sqle; ! } ! finally { ! ups.close(); ! } ! } ! while (rows==0); ! ! conn.commit(); ! ! lo = 0; ! hi = hiInt; ! ! } ! finally { ! ! if (connections==null) { ! session.getFactory().closeConnection(conn); ! } ! else { ! connections.closeConnection(conn); ! } ! ! } ! log.debug("New hi value: " + hi); ! } ! ! return new Long( ( hi << 16 ) + lo++ ); ! ! } ! ! ! public String[] sqlCreateStrings(Dialect dialect) throws HibernateException { ! return new String[] { ! "create table " + tableName + " ( " + columnName + " " + dialect.getTypeName(Types.INTEGER) + " )", ! "insert into " + tableName + " values ( 0 )" ! }; ! } ! ! public String sqlDropString(Dialect dialect) { ! return "drop table " + tableName; ! } ! ! public Object generatorKey() { ! return tableName; ! } ! ! } Index: HiLoHexGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/HiLoHexGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HiLoHexGenerator.java 1 Jan 2003 13:54:40 -0000 1.1.1.1 --- HiLoHexGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 8,15 **** import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>hilo.hex</b><br> * <br> ! * Returns a string of hex digits of length 16. Otherwise identical to * <tt>HiLoGenerator</tt>.<br> * <br> --- 8,15 ---- import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>hilo.hex</b><br> * <br> ! * Returns a string of hex digits of length 16. Otherwise identical to * <tt>HiLoGenerator</tt>.<br> * <br> *************** *** 19,27 **** public class HiLoHexGenerator extends HiLoGenerator { ! public Serializable generate(SessionImplementor session, Object obj) throws SQLException { return Long.toHexString( ( (Long) super.generate(session, obj) ).longValue() ); } ! public HiLoHexGenerator(String driverclass, String url, String username, String password) throws HibernateException { super(driverclass, url, username, password); --- 19,27 ---- public class HiLoHexGenerator extends HiLoGenerator { ! public Serializable generate(SessionImplementor session, Object obj) throws SQLException { return Long.toHexString( ( (Long) super.generate(session, obj) ).longValue() ); } ! public HiLoHexGenerator(String driverclass, String url, String username, String password) throws HibernateException { super(driverclass, url, username, password); *************** *** 31,35 **** super(driverclass, url, username, password, tableName, columnName); } ! public HiLoHexGenerator(String tableName, String columnName) { super(tableName, columnName); --- 31,35 ---- super(driverclass, url, username, password, tableName, columnName); } ! public HiLoHexGenerator(String tableName, String columnName) { super(tableName, columnName); *************** *** 39,44 **** super(); } - } --- 39,47 ---- super(); } + + + } + Index: IdentifierGenerationException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/IdentifierGenerationException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** IdentifierGenerationException.java 1 Jan 2003 13:54:40 -0000 1.1.1.1 --- IdentifierGenerationException.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 5,16 **** /** ! * Thrown by <tt>IdentifierGenerator</tt> implementation class when * ID generation fails. ! * * @see IdentifierGenerator */ public class IdentifierGenerationException extends HibernateException { ! public IdentifierGenerationException(String msg) { super(msg); --- 5,16 ---- /** ! * Thrown by <tt>IdentifierGenerator</tt> implementation class when * ID generation fails. ! * * @see IdentifierGenerator */ public class IdentifierGenerationException extends HibernateException { ! public IdentifierGenerationException(String msg) { super(msg); *************** *** 22,23 **** --- 22,26 ---- } + + + Index: IdentifierGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/IdentifierGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** IdentifierGenerator.java 1 Jan 2003 13:54:40 -0000 1.1.1.1 --- IdentifierGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 9,13 **** import java.sql.SQLException; ! /** * The general contract between a class that generates unique * IDs and the <tt>Session</tt>. It is not intended that this --- 9,13 ---- import java.sql.SQLException; ! /** * The general contract between a class that generates unique * IDs and the <tt>Session</tt>. It is not intended that this *************** *** 21,25 **** * <br> * Implementors MUST be threadsafe ! * * @see PersistentIdentifierGenerator */ --- 21,25 ---- * <br> * Implementors MUST be threadsafe ! * * @see PersistentIdentifierGenerator */ *************** *** 27,31 **** /** * Generate a new identifier. ! * @param session * @param object the entity or toplevel collection for which the id is being generated * @return Serializable a new identifier --- 27,31 ---- /** * Generate a new identifier. ! * @param session * @param object the entity or toplevel collection for which the id is being generated * @return Serializable a new identifier *************** *** 35,36 **** --- 35,39 ---- public Serializable generate(SessionImplementor session, Object object) throws SQLException, HibernateException; } + + + Index: LongGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/LongGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** LongGenerator.java 1 Jan 2003 13:54:41 -0000 1.1.1.1 --- LongGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,19 **** import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>vm.long</b><br> * <br> ! * An <tt>IdentifierGenerator</tt> that returns a <tt>Long</tt>, constructed from the * system time and a counter value. Not safe for use in a cluster! */ public class LongGenerator implements IdentifierGenerator { ! private static short counter = (short) 0; ! protected short getCount() { synchronized(LongGenerator.class) { --- 6,19 ---- import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>vm.long</b><br> * <br> ! * An <tt>IdentifierGenerator</tt> that returns a <tt>Long</tt>, constructed from the * system time and a counter value. Not safe for use in a cluster! */ public class LongGenerator implements IdentifierGenerator { ! private static short counter = (short) 0; ! protected short getCount() { synchronized(LongGenerator.class) { *************** *** 22,30 **** } } ! public Serializable generate(SessionImplementor cache, Object obj) { return new Long( ( System.currentTimeMillis() << 16 ) + getCount() ); } ! public static void main( String[] args ) throws Exception { IdentifierGenerator gen = new LongGenerator(); --- 22,30 ---- } } ! public Serializable generate(SessionImplementor cache, Object obj) { return new Long( ( System.currentTimeMillis() << 16 ) + getCount() ); } ! public static void main( String[] args ) throws Exception { IdentifierGenerator gen = new LongGenerator(); *************** *** 34,37 **** } } ! } --- 34,40 ---- } } ! } + + + Index: NativeGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/NativeGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** NativeGenerator.java 1 Jan 2003 13:54:41 -0000 1.1.1.1 --- NativeGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 12,19 **** * <b>native</b><br> * <br> ! * Indicates to the <tt>Session</tt> that identity (ie. identity/autoincrement ! * column) key generation should be used, if supported. Otherwise a sequence is * used. ! * * @see SequenceGenerator */ --- 12,19 ---- * <b>native</b><br> * <br> ! * Indicates to the <tt>Session</tt> that identity (ie. identity/autoincrement ! * column) key generation should be used, if supported. Otherwise a sequence is * used. ! * * @see SequenceGenerator */ *************** *** 28,55 **** seqgen = new SequenceGenerator(sequenceName); } ! ! public Serializable generate(SessionImplementor s, Object obj) throws SQLException, HibernateException { ! if ( s.getFactory().getDialect().supportsIdentityColumns() ) { ! return null; ! } ! else { ! return seqgen.generate(s, obj); ! } ! } ! public Object generatorKey() { return "native:" + (String) seqgen.generatorKey(); } ! public String[] sqlCreateStrings(Dialect dialect) ! throws HibernateException { return dialect.supportsIdentityColumns() ? ! new String[0] : ! seqgen.sqlCreateStrings(dialect); } ! public String sqlDropString(Dialect dialect) throws HibernateException { return dialect.supportsIdentityColumns() ? null : seqgen.sqlDropString(dialect); } ! } --- 28,58 ---- seqgen = new SequenceGenerator(sequenceName); } ! ! public Serializable generate(SessionImplementor s, Object obj) throws SQLException, HibernateException { ! if ( s.getFactory().getDialect().supportsIdentityColumns() ) { ! return null; ! } ! else { ! return seqgen.generate(s, obj); ! } ! } ! public Object generatorKey() { return "native:" + (String) seqgen.generatorKey(); } ! public String[] sqlCreateStrings(Dialect dialect) ! throws HibernateException { return dialect.supportsIdentityColumns() ? ! new String[0] : ! seqgen.sqlCreateStrings(dialect); } ! public String sqlDropString(Dialect dialect) throws HibernateException { return dialect.supportsIdentityColumns() ? null : seqgen.sqlDropString(dialect); } ! } + + + Index: PersistentIdentifierGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/PersistentIdentifierGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PersistentIdentifierGenerator.java 1 Jan 2003 13:54:41 -0000 1.1.1.1 --- PersistentIdentifierGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 7,16 **** /** * An <tt>IdentifierGenerator</tt> that requires creation of database objects. ! * * @see IdentifierGenerator */ public interface PersistentIdentifierGenerator extends IdentifierGenerator { ! /** * The SQL required to create the underlying database objects. --- 7,16 ---- /** * An <tt>IdentifierGenerator</tt> that requires creation of database objects. ! * * @see IdentifierGenerator */ public interface PersistentIdentifierGenerator extends IdentifierGenerator { ! /** * The SQL required to create the underlying database objects. *************** *** 35,38 **** */ public Object generatorKey(); ! } --- 35,41 ---- */ public Object generatorKey(); ! } + + + Index: SequenceGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/SequenceGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SequenceGenerator.java 1 Jan 2003 13:54:42 -0000 1.1.1.1 --- SequenceGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 13,17 **** import net.sf.hibernate.dialect.Dialect; ! /** * <b>sequence</b><br> * <br> --- 13,17 ---- import net.sf.hibernate.dialect.Dialect; ! /** * <b>sequence</b><br> * <br> *************** *** 20,24 **** * <br> * One mapping parameter is supported: sequencename. ! * * @see SequenceHiLoGenerator * @see HiLoGenerator --- 20,24 ---- * <br> * One mapping parameter is supported: sequencename. ! * * @see SequenceHiLoGenerator * @see HiLoGenerator *************** *** 26,34 **** public class SequenceGenerator implements PersistentIdentifierGenerator { ! private final String sequenceName; private static final Log log = LogFactory.getLog(SequenceGenerator.class); ! public SequenceGenerator(String sequenceName) { this.sequenceName = sequenceName; --- 26,34 ---- public class SequenceGenerator implements PersistentIdentifierGenerator { ! private final String sequenceName; private static final Log log = LogFactory.getLog(SequenceGenerator.class); ! public SequenceGenerator(String sequenceName) { this.sequenceName = sequenceName; *************** *** 40,44 **** public Serializable generate(SessionImplementor session, Object obj) throws SQLException, HibernateException { ! String sql = session.getFactory().getDialect().getSequenceNextValString(sequenceName); PreparedStatement st = session.getBatcher().prepareStatement(sql); --- 40,44 ---- public Serializable generate(SessionImplementor session, Object obj) throws SQLException, HibernateException { ! String sql = session.getFactory().getDialect().getSequenceNextValString(sequenceName); PreparedStatement st = session.getBatcher().prepareStatement(sql); *************** *** 71,82 **** }; } ! public String sqlDropString(Dialect dialect) throws HibernateException { return dialect.getDropSequenceString(sequenceName); } ! public Object generatorKey() { return sequenceName; } ! } --- 71,85 ---- }; } ! public String sqlDropString(Dialect dialect) throws HibernateException { return dialect.getDropSequenceString(sequenceName); } ! public Object generatorKey() { return sequenceName; } ! } + + + Index: SequenceHiLoGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/SequenceHiLoGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SequenceHiLoGenerator.java 1 Jan 2003 13:54:42 -0000 1.1.1.1 --- SequenceHiLoGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 15,26 **** * <br> * An <tt>IdentifierGenerator</tt> that combines a hi/lo algorithm with an underlying ! * oracle-style sequence that generates hi values. The user may specify a * maximum lo value to determine how often new hi values are fetched.<br> * <br> ! * If sequences are not available, <tt>HiLoGenerator</tt> might be an * alternative.<br> * <br> * One mapping parameter is supported: sequencename. ! * * @see HiLoGenerator */ --- 15,26 ---- * <br> * An <tt>IdentifierGenerator</tt> that combines a hi/lo algorithm with an underlying ! * oracle-style sequence that generates hi values. The user may specify a * maximum lo value to determine how often new hi values are fetched.<br> * <br> ! * If sequences are not available, <tt>HiLoGenerator</tt> might be an * alternative.<br> * <br> * One mapping parameter is supported: sequencename. ! * * @see HiLoGenerator */ *************** *** 44,48 **** this("hibernate_sequence"); } ! public synchronized Serializable generate(SessionImplementor session, Object obj) throws SQLException, HibernateException { if ( lo==maxLoValue ) { --- 44,48 ---- this("hibernate_sequence"); } ! public synchronized Serializable generate(SessionImplementor session, Object obj) throws SQLException, HibernateException { if ( lo==maxLoValue ) { *************** *** 54,57 **** return new Long( hi + lo++ ); } ! } --- 54,60 ---- return new Long( hi + lo++ ); } ! } + + + Index: UUIDGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/UUIDGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** UUIDGenerator.java 1 Jan 2003 13:54:42 -0000 1.1.1.1 --- UUIDGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 5,12 **** import net.sf.hibernate.util.BytesHelper; ! /** * The base class for ID generators that use a UUID algorithm. This * class implements the algorithm, subclasses define the ID format. ! * * @see UUIDHexGenerator * @see UUIDStringGenerator --- 5,12 ---- import net.sf.hibernate.util.BytesHelper; ! /** * The base class for ID generators that use a UUID algorithm. This * class implements the algorithm, subclasses define the ID format. ! * * @see UUIDHexGenerator * @see UUIDStringGenerator *************** *** 14,18 **** public abstract class UUIDGenerator implements IdentifierGenerator { ! private static final int ip; static { --- 14,18 ---- public abstract class UUIDGenerator implements IdentifierGenerator { ! private static final int ip; static { *************** *** 28,36 **** private static short counter = (short) 0; private static final int jvm = (int) ( System.currentTimeMillis() >>> 8 ); ! public UUIDGenerator() { } ! ! /** * Unique across JVMs on this machine (unless they load this class * in the same quater second - very unlikely) --- 28,36 ---- private static short counter = (short) 0; private static final int jvm = (int) ( System.currentTimeMillis() >>> 8 ); ! public UUIDGenerator() { } ! ! /** * Unique across JVMs on this machine (unless they load this class * in the same quater second - very unlikely) *************** *** 39,44 **** return jvm; } ! ! /** * Unique in a millisecond for this JVM instance (unless there * are > Short.MAX_VALUE instances created in a millisecond) --- 39,44 ---- return jvm; } ! ! /** * Unique in a millisecond for this JVM instance (unless there * are > Short.MAX_VALUE instances created in a millisecond) *************** *** 50,55 **** } } ! ! /** * Unique in a local network */ --- 50,55 ---- } } ! ! /** * Unique in a local network */ *************** *** 57,62 **** return ip; } ! ! /** * Unique down to millisecond */ --- 57,62 ---- return ip; } ! ! /** * Unique down to millisecond */ *************** *** 67,71 **** return (int) System.currentTimeMillis(); } - } \ No newline at end of file --- 67,73 ---- return (int) System.currentTimeMillis(); } + + + } Index: UUIDHexGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/UUIDHexGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** UUIDHexGenerator.java 1 Jan 2003 13:54:42 -0000 1.1.1.1 --- UUIDHexGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,10 **** import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>uuid.hex</b><br> * <br> --- 6,10 ---- import net.sf.hibernate.engine.SessionImplementor; ! /** * <b>uuid.hex</b><br> * <br> *************** *** 13,17 **** * Optionally, the string may be generated with seperators * between each component of the UUID. ! * * @see UUIDStringGenerator */ --- 13,17 ---- * Optionally, the string may be generated with seperators * between each component of the UUID. ! * * @see UUIDStringGenerator */ *************** *** 20,34 **** private final String sep; ! public UUIDHexGenerator() { super(); sep = ""; } ! public UUIDHexGenerator(String sep) { super(); this.sep=sep; } ! protected String format(int intval) { String formatted = Integer.toHexString(intval); --- 20,34 ---- private final String sep; ! public UUIDHexGenerator() { super(); sep = ""; } ! public UUIDHexGenerator(String sep) { super(); this.sep=sep; } ! protected String format(int intval) { String formatted = Integer.toHexString(intval); *************** *** 37,41 **** return buf.toString(); } ! protected String format(short shortval) { String formatted = Integer.toHexString(shortval); --- 37,41 ---- return buf.toString(); } ! protected String format(short shortval) { String formatted = Integer.toHexString(shortval); *************** *** 44,58 **** return buf.toString(); } ! public Serializable generate(SessionImplementor cache, Object obj) { return new StringBuffer(36) ! .append( format( getIP() ) ).append(sep) ! .append( format( getJVM() ) ).append(sep) ! .append( format( getHiTime() ) ).append(sep) ! .append( format( getLoTime() ) ).append(sep) ! .append( format( getCount() ) ) ! .toString(); } ! public static void main( String[] args ) throws Exception { IdentifierGenerator gen = new UUIDHexGenerator("/"); --- 44,58 ---- return buf.toString(); } ! public Serializable generate(SessionImplementor cache, Object obj) { return new StringBuffer(36) ! .append( format( getIP() ) ).append(sep) ! .append( format( getJVM() ) ).append(sep) ! .append( format( getHiTime() ) ).append(sep) ! .append( format( getLoTime() ) ).append(sep) ! .append( format( getCount() ) ) ! .toString(); } ! public static void main( String[] args ) throws Exception { IdentifierGenerator gen = new UUIDHexGenerator("/"); *************** *** 65,69 **** } } - } --- 65,72 ---- } } + + + } + Index: UUIDStringGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/UUIDStringGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** UUIDStringGenerator.java 1 Jan 2003 13:54:44 -0000 1.1.1.1 --- UUIDStringGenerator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 7,21 **** import net.sf.hibernate.util.*; ! /** * <b>uuid.string</b><br> * <br> * A <tt>UUIDGenerator</tt> that returns a string of length 16, ! * This string will NOT consist of only alphanumeric * characters. Use this only if you don't mind unreadable * identifiers.<br> * <br> ! * This implementation is known to be incompatible with * Postgres. ! * * @see UUIDHexGenerator */ --- 7,21 ---- import net.sf.hibernate.util.*; ! /** * <b>uuid.string</b><br> * <br> * A <tt>UUIDGenerator</tt> that returns a string of length 16, ! * This string will NOT consist of only alphanumeric * characters. Use this only if you don't mind unreadable * identifiers.<br> * <br> ! * This implementation is known to be incompatible with * Postgres. ! * * @see UUIDHexGenerator */ *************** *** 24,48 **** private String sep; ! public UUIDStringGenerator() { super(); sep=""; } ! public UUIDStringGenerator(String sep) { super(); this.sep=sep; } ! public Serializable generate(SessionImplementor cache, Object obj) { return new StringBuffer(20) ! .append( toString( getIP() ) ).append(sep) ! .append( toString( getJVM() ) ).append(sep) ! .append( toString( getHiTime() ) ).append(sep) ! .append( toString( getLoTime() ) ).append(sep) ! .append( toString( getCount() ) ) ! .toString(); } ! public static void main( String[] args ) throws Exception { IdentifierGenerator gen = new UUIDStringGenerator();//("/"); --- 24,48 ---- private String sep; ! public UUIDStringGenerator() { super(); sep=""; } ! public UUIDStringGenerator(String sep) { super(); this.sep=sep; } ! public Serializable generate(SessionImplementor cache, Object obj) { return new StringBuffer(20) ! .append( toString( getIP() ) ).append(sep) ! .append( toString( getJVM() ) ).append(sep) ! .append( toString( getHiTime() ) ).append(sep) ! .append( toString( getLoTime() ) ).append(sep) ! .append( toString( getCount() ) ) ! .toString(); } ! public static void main( String[] args ) throws Exception { IdentifierGenerator gen = new UUIDStringGenerator();//("/"); *************** *** 56,63 **** return new String ( BytesHelper.toBytes(value) ); } ! private static String toString(short value) { return new String ( BytesHelper.toBytes(value) ); } ! } --- 56,66 ---- return new String ( BytesHelper.toBytes(value) ); } ! private static String toString(short value) { return new String ( BytesHelper.toBytes(value) ); } ! } + + + |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/hql Modified Files: ClauseParser.java FilterTranslator.java FromParser.java GroupByParser.java HavingParser.java OrderByParser.java Parser.java ParserHelper.java PathExpressionParser.java PreprocessingParser.java QueryTranslator.java SelectParser.java SelectPathExpressionParser.java WhereParser.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: ClauseParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/ClauseParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ClauseParser.java 1 Jan 2003 13:54:23 -0000 1.1.1.1 --- ClauseParser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 22,29 **** String lcToken = token.toLowerCase(); ! if ( byExpected && !lcToken.equals("by") ) ! throw new QueryException("BY expected after GROUP or ORDER: " + token); - if ( !enableSubselect && lcToken.equals("select") ) { selectTokens = new ArrayList(); --- 22,29 ---- String lcToken = token.toLowerCase(); ! if ( byExpected && !lcToken.equals("by") ) ! throw new QueryException("BY expected after GROUP or ORDER: " + token); ! if ( !enableSubselect && lcToken.equals("select") ) { selectTokens = new ArrayList(); *************** *** 57,61 **** byExpected = true; } ! else if ( lcToken.equals("by") ) { if ( !byExpected ) throw new QueryException("GROUP or ORDER expected before BY"); child.start(q); --- 57,61 ---- byExpected = true; } ! else if ( lcToken.equals("by") ) { if ( !byExpected ) throw new QueryException("GROUP or ORDER expected before BY"); child.start(q); *************** *** 78,93 **** private void endChild(QueryTranslator q) throws QueryException { ! if (child==null) { //null child could occur for no from clause in a filter cacheSelectTokens = false; } else { ! child.end(q); } } ! public void start(QueryTranslator q) { } ! public void end(QueryTranslator q) throws QueryException { endChild(q); --- 78,93 ---- private void endChild(QueryTranslator q) throws QueryException { ! if (child==null) { //null child could occur for no from clause in a filter cacheSelectTokens = false; } else { ! child.end(q); } } ! public void start(QueryTranslator q) { } ! public void end(QueryTranslator q) throws QueryException { endChild(q); *************** *** 105,109 **** cacheSelectTokens = false; } ! } --- 105,112 ---- cacheSelectTokens = false; } ! } + + + Index: FilterTranslator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/FilterTranslator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** FilterTranslator.java 1 Jan 2003 13:54:23 -0000 1.1.1.1 --- FilterTranslator.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 17,30 **** * times. Subsequent invocations are no-ops. */ ! public synchronized void compile(String collectionRole, SessionFactoryImplementor factory, String queryString, Map replacements, boolean scalar) ! throws QueryException, MappingException { if (!compiled) { this.factory = factory; // yick! addFromCollection("this", collectionRole); ! super.compile(factory, queryString, replacements, scalar); } } - } --- 17,33 ---- * times. Subsequent invocations are no-ops. */ ! public synchronized void compile(String collectionRole, SessionFactoryImplementor factory, String queryString, Map replacements, boolean scalar) ! throws QueryException, MappingException { if (!compiled) { this.factory = factory; // yick! addFromCollection("this", collectionRole); ! super.compile(factory, queryString, replacements, scalar); } } + + + } + Index: FromParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/FromParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** FromParser.java 1 Jan 2003 13:54:24 -0000 1.1.1.1 --- FromParser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 10,22 **** public class FromParser implements Parser { ! private boolean expectingIn; ! private boolean expectingComma; private boolean fromClass; private String name; private PathExpressionParser peParser = new PathExpressionParser(); - - public void token(String token, QueryTranslator q) throws QueryException { String lcToken = token.toLowerCase(); if ( lcToken.equals("class") ) { --- 10,22 ---- public class FromParser implements Parser { ! private boolean expectingIn; ! private boolean expectingComma; private boolean fromClass; private String name; private PathExpressionParser peParser = new PathExpressionParser(); + public void token(String token, QueryTranslator q) throws QueryException { + String lcToken = token.toLowerCase(); if ( lcToken.equals("class") ) { *************** *** 58,72 **** } } ! public void start(QueryTranslator q) { expectingIn = false; ! expectingComma = false; name = null; fromClass = false; } ! public void end(QueryTranslator q) { } ! } --- 58,75 ---- } } ! public void start(QueryTranslator q) { expectingIn = false; ! expectingComma = false; name = null; fromClass = false; } ! public void end(QueryTranslator q) { } ! } + + + Index: GroupByParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/GroupByParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** GroupByParser.java 1 Jan 2003 13:54:24 -0000 1.1.1.1 --- GroupByParser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 13,17 **** // This uses a PathExpressionParser but notice that compound paths are not valid, ! // only bare names and simple paths: // SELECT p FROM p IN CLASS eg.Person GROUP BY p.Name, p.Address, p --- 13,17 ---- // This uses a PathExpressionParser but notice that compound paths are not valid, ! // only bare names and simple paths: // SELECT p FROM p IN CLASS eg.Person GROUP BY p.Name, p.Address, p *************** *** 21,29 **** private PathExpressionParser pathExpressionParser = new PathExpressionParser(); - - public void token(String token, QueryTranslator q) throws QueryException { if ( q.isName( StringHelper.root(token) ) ) { ! ParserHelper.parse(pathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); q.appendGroupByToken( pathExpressionParser.getWhereColumn() ); q.addJoin( pathExpressionParser.getWhereJoin() ); --- 21,29 ---- private PathExpressionParser pathExpressionParser = new PathExpressionParser(); + public void token(String token, QueryTranslator q) throws QueryException { + if ( q.isName( StringHelper.root(token) ) ) { ! ParserHelper.parse(pathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); q.appendGroupByToken( pathExpressionParser.getWhereColumn() ); q.addJoin( pathExpressionParser.getWhereJoin() ); *************** *** 33,43 **** } } ! public void start(QueryTranslator q) throws QueryException { } ! public void end(QueryTranslator q) throws QueryException { } - } \ No newline at end of file --- 33,45 ---- } } ! public void start(QueryTranslator q) throws QueryException { } ! public void end(QueryTranslator q) throws QueryException { } + + + } Index: HavingParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/HavingParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HavingParser.java 1 Jan 2003 13:54:24 -0000 1.1.1.1 --- HavingParser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 7,14 **** */ public class HavingParser extends WhereParser { ! void appendToken(QueryTranslator q, String token) { q.appendHavingToken(token); } ! } --- 7,17 ---- */ public class HavingParser extends WhereParser { ! void appendToken(QueryTranslator q, String token) { q.appendHavingToken(token); } ! } + + + Index: OrderByParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/OrderByParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** OrderByParser.java 1 Jan 2003 13:54:24 -0000 1.1.1.1 --- OrderByParser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 12,16 **** // This uses a PathExpressionParser but notice that compound paths are not valid, ! // only bare names and simple paths: // SELECT p FROM p IN CLASS eg.Person ORDER BY p.Name, p.Address, p --- 12,16 ---- // This uses a PathExpressionParser but notice that compound paths are not valid, ! // only bare names and simple paths: // SELECT p FROM p IN CLASS eg.Person ORDER BY p.Name, p.Address, p *************** *** 20,28 **** private PathExpressionParser pathExpressionParser = new PathExpressionParser(); - - public void token(String token, QueryTranslator q) throws QueryException { if ( q.isName( StringHelper.root(token) ) ) { ! ParserHelper.parse(pathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); q.appendOrderByToken( pathExpressionParser.getWhereColumn() ); q.addJoin( pathExpressionParser.getWhereJoin() ); --- 20,28 ---- private PathExpressionParser pathExpressionParser = new PathExpressionParser(); + public void token(String token, QueryTranslator q) throws QueryException { + if ( q.isName( StringHelper.root(token) ) ) { ! ParserHelper.parse(pathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); q.appendOrderByToken( pathExpressionParser.getWhereColumn() ); q.addJoin( pathExpressionParser.getWhereJoin() ); *************** *** 32,42 **** } } ! public void start(QueryTranslator q) throws QueryException { } ! public void end(QueryTranslator q) throws QueryException { } ! } --- 32,45 ---- } } ! public void start(QueryTranslator q) throws QueryException { } ! public void end(QueryTranslator q) throws QueryException { } ! } + + + Index: Parser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/Parser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Parser.java 1 Jan 2003 13:54:24 -0000 1.1.1.1 --- Parser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 17,18 **** --- 17,21 ---- } + + + Index: ParserHelper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/ParserHelper.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ParserHelper.java 1 Jan 2003 13:54:30 -0000 1.1.1.1 --- ParserHelper.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 9,15 **** 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 = "."; --- 9,15 ---- 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 = "."; *************** *** 19,23 **** return whitespace.indexOf(str) > -1; } ! private ParserHelper() { //cannot instantiate --- 19,23 ---- return whitespace.indexOf(str) > -1; } ! private ParserHelper() { //cannot instantiate *************** *** 32,33 **** --- 32,36 ---- } + + + Index: PathExpressionParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/PathExpressionParser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PathExpressionParser.java 3 Jan 2003 13:36:00 -0000 1.2 --- PathExpressionParser.java 4 Jan 2003 11:15:28 -0000 1.3 *************** *** 29,33 **** public static final String COLLECTION_MAX_ELEMENT = "maxElement"; public static final String COLLECTION_MIN_ELEMENT = "minElement"; ! private int dotcount; protected String currentName; --- 29,33 ---- public static final String COLLECTION_MAX_ELEMENT = "maxElement"; public static final String COLLECTION_MIN_ELEMENT = "minElement"; ! private int dotcount; protected String currentName; *************** *** 45,63 **** private boolean skippedId; private boolean continuation; ! private void addJoin(String name, String[] rhsCols, QueryTranslator q) throws QueryException { String[] lhsCols = currentColumns(q); for ( int i=0; i<rhsCols.length; i++) { join.append(" and ") ! .append( lhsCols[i] ) ! .append('=') ! .append(name) ! .append('.') ! .append( rhsCols[i] ); } } public String continueFromManyToMany(Class clazz, String[] joinColumns, QueryTranslator q) throws QueryException { ! start(q); continuation=true; currentName = q.createNameFor(clazz); --- 45,63 ---- private boolean skippedId; private boolean continuation; ! private void addJoin(String name, String[] rhsCols, QueryTranslator q) throws QueryException { String[] lhsCols = currentColumns(q); for ( int i=0; i<rhsCols.length; i++) { join.append(" and ") ! .append( lhsCols[i] ) ! .append('=') ! .append(name) ! .append('.') ! .append( rhsCols[i] ); } } public String continueFromManyToMany(Class clazz, String[] joinColumns, QueryTranslator q) throws QueryException { ! start(q); continuation=true; currentName = q.createNameFor(clazz); *************** *** 66,74 **** for ( int i=0; i<joinColumns.length; i++ ) { join.append(" and ") ! .append( joinColumns[i] ) ! .append('=') ! .append(currentName) ! .append('.') ! .append( q.getPersister(clazz).getIdentifierColumnNames()[i] ); } return currentName; --- 66,74 ---- for ( int i=0; i<joinColumns.length; i++ ) { join.append(" and ") ! .append( joinColumns[i] ) ! .append('=') ! .append(currentName) ! .append('.') ! .append( q.getPersister(clazz).getIdentifierColumnNames()[i] ); } return currentName; *************** *** 76,80 **** public String continueFromSubcollection(String role, String[] joinColumns, QueryTranslator q) throws QueryException { ! start(q); continuation=true; collectionName = q.createNameForCollection(role); --- 76,80 ---- public String continueFromSubcollection(String role, String[] joinColumns, QueryTranslator q) throws QueryException { ! start(q); continuation=true; collectionName = q.createNameForCollection(role); *************** *** 84,99 **** CollectionPersister p = q.getCollectionPersister(role); collectionTable = p.getQualifiedTableName(); ! for ( int i=0; i<joinColumns.length; i++ ) { join.append(" and ") ! .append( joinColumns[i] ) ! .append('=') ! .append(collectionName) ! .append('.') ! .append( p.getKeyColumnNames()[i] ); } return collectionName; } ! public void token(String token, QueryTranslator q) throws QueryException { --- 84,99 ---- CollectionPersister p = q.getCollectionPersister(role); collectionTable = p.getQualifiedTableName(); ! for ( int i=0; i<joinColumns.length; i++ ) { join.append(" and ") ! .append( joinColumns[i] ) ! .append('=') ! .append(collectionName) ! .append('.') ! .append( p.getKeyColumnNames()[i] ); } return collectionName; } ! public void token(String token, QueryTranslator q) throws QueryException { *************** *** 112,119 **** else { if ( dotcount==0 ) { ! if (!continuation) { ! if ( !q.isName(token) ) throw new QueryException("undefined alias: " + token); ! currentName=token; ! } } else if (dotcount==1) { --- 112,119 ---- else { if ( dotcount==0 ) { ! if (!continuation) { ! if ( !q.isName(token) ) throw new QueryException("undefined alias: " + token); ! currentName=token; ! } } else if (dotcount==1) { *************** *** 134,138 **** // Do the corresponding RHS Type propertyType = getPropertyType(q); ! if (propertyType==null) { throw new QueryException("unresolved property: " + currentProperty); --- 134,138 ---- // Do the corresponding RHS Type propertyType = getPropertyType(q); ! if (propertyType==null) { throw new QueryException("unresolved property: " + currentProperty); *************** *** 148,161 **** } else { ! if ( propertyType.isEntityType() ) { Class memberClass = ( (EntityType) propertyType ).getPersistentClass(); Queryable memberPersister = q.getPersister(memberClass); ! if ( // if its "id" ! ENTITY_ID.equals(token) || ( //or its the id property name ! memberPersister.hasIdentifierProperty() && ! memberPersister.getIdentifierPropertyName().equals(token) ) ) { --- 148,161 ---- } else { ! if ( propertyType.isEntityType() ) { Class memberClass = ( (EntityType) propertyType ).getPersistentClass(); Queryable memberPersister = q.getPersister(memberClass); ! if ( // if its "id" ! ENTITY_ID.equals(token) || ( //or its the id property name ! memberPersister.hasIdentifierProperty() && ! memberPersister.getIdentifierPropertyName().equals(token) ) ) { *************** *** 194,198 **** else { if (token!=null) throw new QueryException( ! "dereferenced: " + currentProperty ); --- 194,198 ---- else { if (token!=null) throw new QueryException( ! "dereferenced: " + currentProperty ); *************** *** 200,204 **** } ! } } --- 200,204 ---- } ! } } *************** *** 210,216 **** } else { ! return currentProperty + ! ( skippedId ? '.' + ENTITY_ID : "" ) + ! ( (componentPath==null) ? "" : '.' + componentPath ); } } --- 210,216 ---- } else { ! return currentProperty + ! ( skippedId ? '.' + ENTITY_ID : "" ) + ! ( (componentPath==null) ? "" : '.' + componentPath ); } } *************** *** 259,263 **** } } ! public void end(QueryTranslator q) throws QueryException { if ( isCollectionValued() ) { --- 259,263 ---- } } ! public void end(QueryTranslator q) throws QueryException { if ( isCollectionValued() ) { *************** *** 278,282 **** CollectionPersister memberPersister = q.getCollectionPersister(collectionRole); if ( !memberPersister.hasIndex() ) throw new QueryException("unindexed collection before []"); ! String[] keyCols = memberPersister.getKeyColumnNames(); --- 278,282 ---- CollectionPersister memberPersister = q.getCollectionPersister(collectionRole); if ( !memberPersister.hasIndex() ) throw new QueryException("unindexed collection before []"); ! String[] keyCols = memberPersister.getKeyColumnNames(); *************** *** 286,298 **** if ( indexCols.length!=1 ) throw new QueryException("composite-index appears in []"); join.append(" and ") ! .append(collectionName) ! .append('.') ! .append( indexCols[0] ) ! .append("="); String[] eltCols = memberPersister.getElementColumnNames(); //if ( eltCols.length!=1 ) throw new QueryException("composite-id collection element []"); ! CollectionElement elem = new CollectionElement(); elem.elementColumns = StringHelper.prefix( eltCols, collectionName + '.' ); elem.type = memberPersister.getElementType(); --- 286,298 ---- if ( indexCols.length!=1 ) throw new QueryException("composite-index appears in []"); join.append(" and ") ! .append(collectionName) ! .append('.') ! .append( indexCols[0] ) ! .append("="); String[] eltCols = memberPersister.getElementColumnNames(); //if ( eltCols.length!=1 ) throw new QueryException("composite-id collection element []"); ! CollectionElement elem = new CollectionElement(); elem.elementColumns = StringHelper.prefix( eltCols, collectionName + '.' ); elem.type = memberPersister.getElementType(); *************** *** 309,318 **** setType(q); } ! } //important!! continuation=false; ! } --- 309,318 ---- setType(q); } ! } //important!! continuation=false; ! } *************** *** 356,369 **** return type; } ! public String getCollectionSubquery(String extraJoin) throws QueryException { if (extraJoin!=null) join.append(extraJoin); return new StringBuffer( "SELECT " ) ! .append( StringHelper.join( ", ", collectionElementColumns ) ) ! .append(" FROM ").append(collectionTable).append(' ').append(collectionName) ! .append(" WHERE ").append( join.substring(5).toString() ) // remove initial " and " ! .toString(); } ! public boolean isCollectionValued() { return collectionElementColumns!=null; --- 356,369 ---- return type; } ! public String getCollectionSubquery(String extraJoin) throws QueryException { if (extraJoin!=null) join.append(extraJoin); return new StringBuffer( "SELECT " ) ! .append( StringHelper.join( ", ", collectionElementColumns ) ) ! .append(" FROM ").append(collectionTable).append(' ').append(collectionName) ! .append(" WHERE ").append( join.substring(5).toString() ) // remove initial " and " ! .toString(); } ! public boolean isCollectionValued() { return collectionElementColumns!=null; *************** *** 371,375 **** public void addFromCollection(QueryTranslator q, String elementName) throws QueryException { ! if ( !collectionElementType.isEntityType() ) throw new QueryException( "collection of values in from clause: " + elementName --- 371,375 ---- public void addFromCollection(QueryTranslator q, String elementName) throws QueryException { ! if ( !collectionElementType.isEntityType() ) throw new QueryException( "collection of values in from clause: " + elementName *************** *** 379,383 **** CollectionPersister persister = q.getCollectionPersister(collectionRole); ! if ( persister.isOneToMany() ) { q.addJoin( StringHelper.replace( join.toString(), collectionName, elementName ) ); } --- 379,383 ---- CollectionPersister persister = q.getCollectionPersister(collectionRole); ! if ( persister.isOneToMany() ) { q.addJoin( StringHelper.replace( join.toString(), collectionName, elementName ) ); } *************** *** 388,396 **** for ( int i=0; i<keyColumnNames.length; i++ ) { join.append(" and ") ! .append( collectionElementColumns[i] ) //already qualified ! .append('=') ! .append(elementName) ! .append('.') ! .append( keyColumnNames[i] ); } q.addJoin( join.toString() ); --- 388,396 ---- for ( int i=0; i<keyColumnNames.length; i++ ) { join.append(" and ") ! .append( collectionElementColumns[i] ) //already qualified ! .append('=') ! .append(elementName) ! .append('.') ! .append( keyColumnNames[i] ); } q.addJoin( join.toString() ); *************** *** 454,458 **** } } ! } --- 454,461 ---- } } ! } + + + Index: PreprocessingParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/PreprocessingParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PreprocessingParser.java 1 Jan 2003 13:54:33 -0000 1.1.1.1 --- PreprocessingParser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 9,13 **** /** ! * */ public class PreprocessingParser implements Parser { --- 9,13 ---- /** ! * */ public class PreprocessingParser implements Parser { *************** *** 42,46 **** this.replacements=replacements; } ! /** * @see net.sf.hibernate.query.Parser#token(String, QueryTranslator) --- 42,46 ---- this.replacements=replacements; } ! /** * @see net.sf.hibernate.query.Parser#token(String, QueryTranslator) *************** *** 76,81 **** else { String doubleToken = (token.length()>1) ? ! lastToken + ' ' + token : ! lastToken + token; if ( operators.contains( doubleToken.toLowerCase() ) ) { parser.token(doubleToken, q); --- 76,81 ---- else { String doubleToken = (token.length()>1) ? ! lastToken + ' ' + token : ! lastToken + token; if ( operators.contains( doubleToken.toLowerCase() ) ) { parser.token(doubleToken, q); *************** *** 89,93 **** } ! /** * @see net.sf.hibernate.query.Parser#start(QueryTranslator) --- 89,93 ---- } ! /** * @see net.sf.hibernate.query.Parser#start(QueryTranslator) *************** *** 97,101 **** parser.start(q); } ! /** * @see net.sf.hibernate.query.Parser#end(QueryTranslator) --- 97,101 ---- parser.start(q); } ! /** * @see net.sf.hibernate.query.Parser#end(QueryTranslator) *************** *** 105,108 **** parser.end(q); } ! } --- 105,111 ---- parser.end(q); } ! } + + + Index: QueryTranslator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/QueryTranslator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QueryTranslator.java 3 Jan 2003 13:36:00 -0000 1.2 --- QueryTranslator.java 4 Jan 2003 11:15:28 -0000 1.3 *************** *** 46,50 **** public class QueryTranslator extends Loader { ! private static final HashSet dontSpace = new HashSet(); static { --- 46,50 ---- public class QueryTranslator extends Loader { ! private static final HashSet dontSpace = new HashSet(); static { *************** *** 90,94 **** private final List groupByTokens = new ArrayList(); private final Set identifierSpaces = new HashSet(); ! private Queryable[] persisters; private Type[] types; --- 90,94 ---- private final List groupByTokens = new ArrayList(); private final Set identifierSpaces = new HashSet(); ! private Queryable[] persisters; private Type[] types; *************** *** 109,113 **** private String[] suffixes; ! private static final Log log = LogFactory.getLog(QueryTranslator.class); --- 109,113 ---- private String[] suffixes; ! private static final Log log = LogFactory.getLog(QueryTranslator.class); *************** *** 128,138 **** compile(queryString); } ! ! /** * Compile a "normal" query. This method may be called multiple * times. Subsequent invocations are no-ops. */ ! public synchronized void compile(SessionFactoryImplementor factory, String queryString, Map replacements, boolean scalar) throws QueryException, MappingException { if (!compiled) { this.factory = factory; --- 128,138 ---- compile(queryString); } ! ! /** * Compile a "normal" query. This method may be called multiple * times. Subsequent invocations are no-ops. */ ! public synchronized void compile(SessionFactoryImplementor factory, String queryString, Map replacements, boolean scalar) throws QueryException, MappingException { if (!compiled) { this.factory = factory; *************** *** 142,146 **** } } ! /** * Compile the query (generate the SQL). --- 142,146 ---- } } ! /** * Compile the query (generate the SQL). *************** *** 149,153 **** this.queryString = queryString; ! log.trace("compiling query"); try { --- 149,153 ---- this.queryString = queryString; ! log.trace("compiling query"); try { *************** *** 210,220 **** protected String getSQLString() { String result = new StringBuffer(50) ! .append(selectPropertiesString) ! .append(fromWhereString) ! .toString(); logQuery(queryString, result); return result; } ! /** * Return the SQL for an <tt>iterate()</tt> style query. --- 210,220 ---- protected String getSQLString() { String result = new StringBuffer(50) ! .append(selectPropertiesString) ! .append(fromWhereString) ! .toString(); logQuery(queryString, result); return result; } ! /** * Return the SQL for an <tt>iterate()</tt> style query. *************** *** 223,233 **** protected String getScalarSelectSQL() { String result= new StringBuffer(50) ! .append(scalarSelectString) ! .append(fromWhereString) ! .toString(); logQuery(queryString, result); return result; } ! private String prefix(String s) { if ( s.length()>3 ) { --- 223,233 ---- protected String getScalarSelectSQL() { String result= new StringBuffer(50) ! .append(scalarSelectString) ! .append(fromWhereString) ! .toString(); logQuery(queryString, result); return result; } ! private String prefix(String s) { if ( s.length()>3 ) { *************** *** 432,439 **** String selectPerhapsDistinct = "SELECT "; ! if (distinct) selectPerhapsDistinct += "DISTINCT "; String selectScalars = renderScalarSelect(); scalarSelectString = selectPerhapsDistinct + selectScalars; ! String selectIdentifiers = renderIdentifierSelect(); selectPropertiesString = selectPerhapsDistinct + selectIdentifiers + renderPropertiesSelect(); //TODO: for some dialiects it would be appropriate to add the renderOrderByPropertiesSelect() to other select strings --- 432,439 ---- String selectPerhapsDistinct = "SELECT "; ! if (distinct) selectPerhapsDistinct += "DISTINCT "; String selectScalars = renderScalarSelect(); scalarSelectString = selectPerhapsDistinct + selectScalars; ! String selectIdentifiers = renderIdentifierSelect(); selectPropertiesString = selectPerhapsDistinct + selectIdentifiers + renderPropertiesSelect(); //TODO: for some dialiects it would be appropriate to add the renderOrderByPropertiesSelect() to other select strings *************** *** 444,448 **** selectPropertiesString += selectScalars; } ! int scalarSize = scalarTypes.size(); types = new Type[scalarSize]; --- 444,448 ---- selectPropertiesString += selectScalars; } ! int scalarSize = scalarTypes.size(); types = new Type[scalarSize]; *************** *** 450,454 **** types[i] = (Type) scalarTypes.get(i); } ! scalarColumnNames = generateColumnNames(types, factory); --- 450,454 ---- types[i] = (Type) scalarTypes.get(i); } ! scalarColumnNames = generateColumnNames(types, factory); *************** *** 464,468 **** addIdentifierSpace( p.getIdentifierSpace() ); } ! } --- 464,468 ---- addIdentifierSpace( p.getIdentifierSpace() ); } ! } *************** *** 483,492 **** private String renderOrderByPropertiesSelect() { StringBuffer buf = new StringBuffer(10); ! //add the columns we are ordering by to the select ID select clause Iterator iter = orderByTokens.iterator(); while ( iter.hasNext() ) { String token = (String) iter.next(); ! if ( token.lastIndexOf(".") > 0 ) { //ie. it is of form "foo.bar", not of form "asc" or "desc" buf.append(", ").append(token); --- 483,492 ---- private String renderOrderByPropertiesSelect() { StringBuffer buf = new StringBuffer(10); ! //add the columns we are ordering by to the select ID select clause Iterator iter = orderByTokens.iterator(); while ( iter.hasNext() ) { String token = (String) iter.next(); ! if ( token.lastIndexOf(".") > 0 ) { //ie. it is of form "foo.bar", not of form "asc" or "desc" buf.append(", ").append(token); *************** *** 521,525 **** int size = returnTypes.size(); for ( int k=0; k<size; k++ ) { ! scalarTypes.add( Hibernate.association( persisters[k].getMappedClass() --- 521,525 ---- int size = returnTypes.size(); for ( int k=0; k<size; k++ ) { ! scalarTypes.add( Hibernate.association( persisters[k].getMappedClass() *************** *** 571,575 **** } if (!isSubselect && !nolast) buf.append(" as ").append( scalarName(c++, 0) ); ! } --- 571,575 ---- } if (!isSubselect && !nolast) buf.append(" as ").append( scalarName(c++, 0) ); ! } *************** *** 580,584 **** //FROM StringBuffer buf = new StringBuffer(120) ! .append(" FROM"); Iterator iter = typeMap.keySet().iterator(); while ( iter.hasNext() ) { --- 580,584 ---- //FROM StringBuffer buf = new StringBuffer(120) ! .append(" FROM"); Iterator iter = typeMap.keySet().iterator(); while ( iter.hasNext() ) { *************** *** 587,591 **** Queryable p = getPersisterForName(name); buf.append(' ') ! .append( p.fromClauseFragment(name, true) ); if ( iter.hasNext() || collections.size()!=0 ) buf.append(','); } --- 587,591 ---- Queryable p = getPersisterForName(name); buf.append(' ') ! .append( p.fromClauseFragment(name, true) ); if ( iter.hasNext() || collections.size()!=0 ) buf.append(','); } *************** *** 606,610 **** private String renderWhereClause() throws QueryException, MappingException { ! Iterator iter = typeMap.keySet().iterator(); StringBuffer inClassWheres = new StringBuffer(50); --- 606,610 ---- private String renderWhereClause() throws QueryException, MappingException { ! Iterator iter = typeMap.keySet().iterator(); StringBuffer inClassWheres = new StringBuffer(50); *************** *** 615,619 **** Queryable p = getPersisterForName(name); addIdentifierSpace( p.getIdentifierSpace() ); ! //render the " and foo.class in ( 'Foo', 'Bar' ) " bit String where = p.getQueryWhereClause(name); --- 615,619 ---- Queryable p = getPersisterForName(name); addIdentifierSpace( p.getIdentifierSpace() ); ! //render the " and foo.class in ( 'Foo', 'Bar' ) " bit String where = p.getQueryWhereClause(name); *************** *** 660,664 **** appendTokens( buf, havingTokens.iterator() ); } ! if ( orderByTokens.size()!=0 ) { //ORDER BY --- 660,664 ---- appendTokens( buf, havingTokens.iterator() ); } ! if ( orderByTokens.size()!=0 ) { //ORDER BY *************** *** 680,688 **** } } ! public Set getQuerySpaces() { return identifierSpaces; } ! public boolean isShallowQuery() { return shallowQuery; --- 680,688 ---- } } ! public Set getQuerySpaces() { return identifierSpaces; } ! public boolean isShallowQuery() { return shallowQuery; *************** *** 697,701 **** this.distinct = distinct; } ! protected CollectionPersister getCollectionPersister() { return null; --- 697,701 ---- this.distinct = distinct; } ! protected CollectionPersister getCollectionPersister() { return null; *************** *** 705,710 **** return suffixes; } ! ! protected void addFromCollection(final String elementName, final String collectionRole) throws QueryException { //q.addCollection(collectionName, collectionRole); --- 705,710 ---- return suffixes; } ! ! protected void addFromCollection(final String elementName, final String collectionRole) throws QueryException { //q.addCollection(collectionName, collectionRole); *************** *** 723,731 **** join.append(" and "); // all conditions must begin with " and " ! if ( persister.isOneToMany() ) { join.append(elementName) ! .append('.') ! .append( keyColumnNames[0] ) ! .append(" = ?"); } else { //many-to-many --- 723,731 ---- join.append(" and "); // all conditions must begin with " and " ! if ( persister.isOneToMany() ) { join.append(elementName) ! .append('.') ! .append( keyColumnNames[0] ) ! .append(" = ?"); } else { //many-to-many *************** *** 733,739 **** addCollection(collectionName, collectionRole); join.append(collectionName) ! .append('.') ! .append( keyColumnNames[0] ) ! .append(" = ?"); String[] idColumnNames = getPersisterForName(elementName).getIdentifierColumnNames(); --- 733,739 ---- addCollection(collectionName, collectionRole); join.append(collectionName) ! .append('.') ! .append( keyColumnNames[0] ) ! .append(" = ?"); String[] idColumnNames = getPersisterForName(elementName).getIdentifierColumnNames(); *************** *** 741,751 **** for ( int i=0; i<idColumnNames.length; i++ ) { join.append(" and ") ! .append(collectionName) ! .append('.') ! .append( eltColumnNames[i] ) ! .append('=') ! .append(elementName) ! .append('.') ! .append( idColumnNames[i] ); } } --- 741,751 ---- for ( int i=0; i<idColumnNames.length; i++ ) { join.append(" and ") ! .append(collectionName) ! .append('.') ! .append( eltColumnNames[i] ) ! .append('=') ! .append(elementName) ! .append('.') ! .append( idColumnNames[i] ); } } *************** *** 768,773 **** pathJoins.put(path, join); } ! ! protected void bindNamedParameters(PreparedStatement ps, Map namedParams, SessionImplementor session) throws SQLException, HibernateException { if (namedParams!=null) { --- 768,773 ---- pathJoins.put(path, join); } ! ! protected void bindNamedParameters(PreparedStatement ps, Map namedParams, SessionImplementor session) throws SQLException, HibernateException { if (namedParams!=null) { *************** *** 780,784 **** for ( int i=0; i<locs.length; i++ ) { typedval.getType().nullSafeSet( ps, typedval.getValue(), locs[i], session ); ! } } } --- 780,784 ---- for ( int i=0; i<locs.length; i++ ) { typedval.getType().nullSafeSet( ps, typedval.getValue(), locs[i], session ); ! } } } *************** *** 786,790 **** public Iterator iterate(Object[] values, Type[] types, RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { ! PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, false, session ); try { --- 786,790 ---- public Iterator iterate(Object[] values, Type[] types, RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { ! PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, false, session ); try { *************** *** 803,807 **** public ScrollableResults scroll(Object[] values, Type[] types, RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { ! PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, true, session ); try { --- 803,807 ---- public ScrollableResults scroll(Object[] values, Type[] types, RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { ! PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, true, session ); try { *************** *** 818,822 **** } } ! public static String[] concreteQueries(String query, SessionFactoryImplementor factory) { StringTokenizer tokens = new StringTokenizer(query, ", "); --- 818,822 ---- } } ! public static String[] concreteQueries(String query, SessionFactoryImplementor factory) { StringTokenizer tokens = new StringTokenizer(query, ", "); *************** *** 875,877 **** --- 875,880 ---- } } + + + Index: SelectParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/SelectParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SelectParser.java 1 Jan 2003 13:54:37 -0000 1.1.1.1 --- SelectParser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 27,39 **** countArguments.add("*"); } ! private boolean ready; private boolean aggregate; private boolean count; private boolean first; ! private SelectPathExpressionParser pathExpressionParser = new SelectPathExpressionParser(); private PathExpressionParser aggregatePathExpressionParser = new PathExpressionParser(); ! public void token(String token, QueryTranslator q) throws QueryException { --- 27,39 ---- countArguments.add("*"); } ! private boolean ready; private boolean aggregate; private boolean count; private boolean first; ! private SelectPathExpressionParser pathExpressionParser = new SelectPathExpressionParser(); private PathExpressionParser aggregatePathExpressionParser = new PathExpressionParser(); ! public void token(String token, QueryTranslator q) throws QueryException { *************** *** 99,105 **** if ( aggregatePathExpressionParser.isCollectionValued() ) { ! q.addCollection( ! aggregatePathExpressionParser.getCollectionName(), ! aggregatePathExpressionParser.getCollectionRole() ); } --- 99,105 ---- if ( aggregatePathExpressionParser.isCollectionValued() ) { ! q.addCollection( ! aggregatePathExpressionParser.getCollectionName(), ! aggregatePathExpressionParser.getCollectionRole() ); } *************** *** 111,119 **** if (!ready) throw new QueryException(", expected in SELECT"); ! ParserHelper.parse(pathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); if ( pathExpressionParser.isCollectionValued() ) { ! q.addCollection( ! pathExpressionParser.getCollectionName(), ! pathExpressionParser.getCollectionRole() ); } --- 111,119 ---- if (!ready) throw new QueryException(", expected in SELECT"); ! ParserHelper.parse(pathExpressionParser, token, ParserHelper.PATH_SEPERATORS, q); if ( pathExpressionParser.isCollectionValued() ) { ! q.addCollection( ! pathExpressionParser.getCollectionName(), ! pathExpressionParser.getCollectionRole() ); } *************** *** 128,132 **** } } ! public void start(QueryTranslator q) { ready=true; --- 128,132 ---- } } ! public void start(QueryTranslator q) { ready=true; *************** *** 135,142 **** count = false; } ! public void end(QueryTranslator q) { } ! } --- 135,145 ---- count = false; } ! public void end(QueryTranslator q) { } ! } + + + Index: SelectPathExpressionParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/SelectPathExpressionParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SelectPathExpressionParser.java 1 Jan 2003 13:54:37 -0000 1.1.1.1 --- SelectPathExpressionParser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 23,27 **** throw new QueryException("expecting .elements or .indices after collection path expression in select"); } ! public String getSelectName() { --- 23,27 ---- throw new QueryException("expecting .elements or .indices after collection path expression in select"); } ! public String getSelectName() { *************** *** 29,31 **** --- 29,34 ---- } } + + + Index: WhereParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/WhereParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WhereParser.java 1 Jan 2003 13:54:39 -0000 1.1.1.1 --- WhereParser.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 38,42 **** private PathExpressionParser pathExpressionParser = new PathExpressionParser(); ! private static final Set expressionTerminators = new HashSet(); //tokens that close a sub expression private static final Set expressionOpeners = new HashSet(); //tokens that open a sub expression --- 38,42 ---- private PathExpressionParser pathExpressionParser = new PathExpressionParser(); ! private static final Set expressionTerminators = new HashSet(); //tokens that close a sub expression private static final Set expressionOpeners = new HashSet(); //tokens that open a sub expression *************** *** 199,203 **** PathExpressionParser.CollectionElement element = pathExpressionParser.lastCollectionElement(); ! if ( token.startsWith(".") ) { // the path expression continues after a ] doPathExpression( getElementName(element, q) + token, q ); // careful with this! --- 199,203 ---- PathExpressionParser.CollectionElement element = pathExpressionParser.lastCollectionElement(); ! if ( token.startsWith(".") ) { // the path expression continues after a ] doPathExpression( getElementName(element, q) + token, q ); // careful with this! *************** *** 222,226 **** } ! //Cope with a subselect --- 222,226 ---- } ! //Cope with a subselect *************** *** 247,251 **** } if (inSubselect) { ! if ( token.equals("(") ) bracketsSinceSelect++; subselect.append(token).append(' '); return; --- 247,251 ---- } if (inSubselect) { ! if ( token.equals("(") ) bracketsSinceSelect++; subselect.append(token).append(' '); return; *************** *** 265,279 **** if ( booleanOperators.contains(lcToken) ) { ! booleanTests.removeLast(); ! booleanTests.addLast(Boolean.TRUE); } if ( lcToken.equals("not") ) { ! nots.addLast( ! new Boolean( !( (Boolean) nots.removeLast() ).booleanValue() ) ); negated = !negated; return; //NOTE: early return ! } //process a token, mapping OO path expressions to SQL expressions --- 265,279 ---- if ( booleanOperators.contains(lcToken) ) { ! booleanTests.removeLast(); ! booleanTests.addLast(Boolean.TRUE); } if ( lcToken.equals("not") ) { ! nots.addLast( ! new Boolean( !( (Boolean) nots.removeLast() ).booleanValue() ) ); negated = !negated; return; //NOTE: early return ! } //process a token, mapping OO path expressions to SQL expressions *************** *** 295,303 **** } ! public void start(QueryTranslator q) throws QueryException { token("(", q); } ! public void end(QueryTranslator q) throws QueryException { if (expectingPathContinuation) { --- 295,303 ---- } ! public void start(QueryTranslator q) throws QueryException { token("(", q); } ! public void end(QueryTranslator q) throws QueryException { if (expectingPathContinuation) { *************** *** 317,333 **** if ( booleanTests.size()>0 ) { // the next one up must also be ! booleanTests.removeLast(); ! booleanTests.addLast(Boolean.TRUE); } ! // Add any joins appendToken(q, ( (StringBuffer) joins.removeLast() ).toString() ); ! // finish off any unary operations /*int count = ( (Integer) unaryCounts.removeLast() ).intValue(); for ( int i=0; i<count; i++ ) { //to allow not not, not not not, etc... appendToken(q, ")"); }*/ ! } else { --- 317,333 ---- if ( booleanTests.size()>0 ) { // the next one up must also be ! booleanTests.removeLast(); ! booleanTests.addLast(Boolean.TRUE); } ! // Add any joins appendToken(q, ( (StringBuffer) joins.removeLast() ).toString() ); ! // finish off any unary operations /*int count = ( (Integer) unaryCounts.removeLast() ).intValue(); for ( int i=0; i<count; i++ ) { //to allow not not, not not not, etc... appendToken(q, ")"); }*/ ! } else { *************** *** 341,345 **** if ( !")".equals(lcToken) ) appendToken(q, ")"); } ! private void openExpression(QueryTranslator q, String lcToken) { //unaryCounts.addLast( new Integer(0) ); --- 341,345 ---- if ( !")".equals(lcToken) ) appendToken(q, ")"); } ! private void openExpression(QueryTranslator q, String lcToken) { //unaryCounts.addLast( new Integer(0) ); *************** *** 381,385 **** } } ! private void doToken(String token, QueryTranslator q) throws QueryException { if ( q.isName( StringHelper.root(token) ) ) { //path expression --- 381,385 ---- } } ! private void doToken(String token, QueryTranslator q) throws QueryException { if ( q.isName( StringHelper.root(token) ) ) { //path expression *************** *** 397,403 **** else { Object constant; ! if ( ! token.indexOf('.')>-1 && ! ( constant=ReflectHelper.getConstantValue(token) )!=null ) { Type type; --- 397,403 ---- else { Object constant; ! if ( ! token.indexOf('.')>-1 && ! ( constant=ReflectHelper.getConstantValue(token) )!=null ) { Type type; *************** *** 455,457 **** --- 455,460 ---- } } + + + |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/dialect Modified Files: DB2Dialect.java Dialect.java GenericDialect.java HSQLDialect.java InterbaseDialect.java MckoiDialect.java MySQLDialect.java OracleDialect.java PointbaseDialect.java PostgreSQLDialect.java ProgressDialect.java SAPDBDialect.java SybaseDialect.java TypeNames.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: DB2Dialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/DB2Dialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DB2Dialect.java 1 Jan 2003 13:54:12 -0000 1.1.1.1 --- DB2Dialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,10 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect for DB2. */ --- 6,10 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect for DB2. */ *************** *** 40,56 **** return false; } ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentitySelectString() { ! return "values IDENTITY_VAL_LOCAL()"; ! } ! public String getIdentityColumnString() { ! return "not null generated by default as identity"; ! } ! public String getIdentityInsertString() { ! return "default"; ! } ! public String getSequenceNextValString(String sequenceName) { return "values nextval for " + sequenceName; --- 40,56 ---- return false; } ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentitySelectString() { ! return "values IDENTITY_VAL_LOCAL()"; ! } ! public String getIdentityColumnString() { ! return "not null generated by default as identity"; ! } ! public String getIdentityInsertString() { ! return "default"; ! } ! public String getSequenceNextValString(String sequenceName) { return "values nextval for " + sequenceName; *************** *** 59,65 **** return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName + " restrict"; ! } ! } --- 59,68 ---- return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName + " restrict"; ! } ! } + + + Index: Dialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/Dialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Dialect.java 1 Jan 2003 13:54:13 -0000 1.1.1.1 --- Dialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 19,26 **** /** ! * Represents a dialect of SQL implemented by a particular RDBMS. * Subclasses implement Hibernate compatibility with different systems.<br> * <br> ! * Subclasses should provide a public default constructor that <tt>register()</tt> * a set of type mappings and default Hibernate properties.<br> * <br> --- 19,26 ---- /** ! * Represents a dialect of SQL implemented by a particular RDBMS. * Subclasses implement Hibernate compatibility with different systems.<br> * <br> ! * Subclasses should provide a public default constructor that <tt>register()</tt> * a set of type mappings and default Hibernate properties.<br> * <br> *************** *** 31,57 **** static final String DEFAULT_BATCH_SIZE = "15"; static final String NO_BATCH = "0"; ! private static final Log log = LogFactory.getLog(Dialect.class); ! ! protected Dialect() { ! log.info( "Using dialect: " + this ); ! } ! ! public String toString() { ! return getClass().getName(); ! } ! private final TypeNames typeNames = new TypeNames("$l"); private final Properties properties = new Properties(); private final OuterJoinGenerator outerJoinGenerator = new AnsiOuterJoinGenerator(); ! /** * Characters used for quoting SQL identifiers */ public static final String QUOTE="`\""; ! ! /** ! * Get the name of the database type associated with the given * <tt>java.sql.Types</tt> typecode. * @param code <tt>java.sql.Types</tt> typecode --- 31,57 ---- static final String DEFAULT_BATCH_SIZE = "15"; static final String NO_BATCH = "0"; ! private static final Log log = LogFactory.getLog(Dialect.class); ! ! protected Dialect() { ! log.info( "Using dialect: " + this ); ! } ! ! public String toString() { ! return getClass().getName(); ! } ! private final TypeNames typeNames = new TypeNames("$l"); private final Properties properties = new Properties(); private final OuterJoinGenerator outerJoinGenerator = new AnsiOuterJoinGenerator(); ! /** * Characters used for quoting SQL identifiers */ public static final String QUOTE="`\""; ! ! /** ! * Get the name of the database type associated with the given * <tt>java.sql.Types</tt> typecode. * @param code <tt>java.sql.Types</tt> typecode *************** *** 59,71 **** * @throws HibernateException */ ! public String getTypeName(int code) throws HibernateException { ! String result = typeNames.get(code); ! if (result == null) ! throw new HibernateException("No default type mapping for (java.sql.Types) " + code); ! return result; ! } ! /** ! * Get the name of the database type associated with the given * <tt>java.sql.Types</tt> typecode. * @param code <tt>java.sql.Types</tt> typecode --- 59,71 ---- * @throws HibernateException */ ! public String getTypeName(int code) throws HibernateException { ! String result = typeNames.get(code); ! if (result == null) ! throw new HibernateException("No default type mapping for (java.sql.Types) " + code); ! return result; ! } ! /** ! * Get the name of the database type associated with the given * <tt>java.sql.Types</tt> typecode. * @param code <tt>java.sql.Types</tt> typecode *************** *** 74,84 **** * @throws HibernateException */ ! public String getTypeName(int code, int length) throws HibernateException { ! String result = typeNames.get(code, length); ! if (result == null) ! throw new HibernateException("No type mapping for (java.sql.Types) " + code + " of length " + length); ! return result; ! } ! /** * Subclasses register a typename for the given type code and maximum --- 74,84 ---- * @throws HibernateException */ ! public String getTypeName(int code, int length) throws HibernateException { ! String result = typeNames.get(code, length); ! if (result == null) ! throw new HibernateException("No type mapping for (java.sql.Types) " + code + " of length " + length); ! return result; ! } ! /** * Subclasses register a typename for the given type code and maximum *************** *** 89,146 **** * @param name the database type name */ ! protected void register(int code, int capacity, String name) { ! typeNames.put(code, capacity, name); ! } ! /** ! * Subclasses register a typename for the given type code. <tt>$l</tt> in * the type name with be replaced by the column length (if appropriate). * @param code <tt>java.sql.Types</tt> typecode * @param name the database type name */ ! protected void register(int code, String name) { ! typeNames.put(code, name); ! } ! /** * Does this dialect support the <tt>ALTER TABLE</tt> syntax? * @return boolean */ ! public boolean hasAlterTable() { ! return true; ! } ! /** * Do we need to drop constraints before dropping tables in this dialect? * @return boolean */ ! public boolean dropConstraints() { ! return true; ! } ! /** * Do we need to qualify index names with the schema name? * @return boolean */ ! public boolean qualifyIndexName() { ! return true; ! } ! /** * Does this dialect support the <tt>FOR UPDATE</tt> syntax? * @return boolean */ ! public boolean supportsForUpdate() { ! return true; ! } ! /** * Does this dialect support the Oracle-style <tt>FOR UPDATE NOWAIT</tt> syntax? * @return boolean */ ! public boolean supportsForUpdateNowait() { ! return false; ! } ! /** * Does this dialect support the <tt>UNIQUE</tt> column syntax? --- 89,146 ---- * @param name the database type name */ ! protected void register(int code, int capacity, String name) { ! typeNames.put(code, capacity, name); ! } ! /** ! * Subclasses register a typename for the given type code. <tt>$l</tt> in * the type name with be replaced by the column length (if appropriate). * @param code <tt>java.sql.Types</tt> typecode * @param name the database type name */ ! protected void register(int code, String name) { ! typeNames.put(code, name); ! } ! /** * Does this dialect support the <tt>ALTER TABLE</tt> syntax? * @return boolean */ ! public boolean hasAlterTable() { ! return true; ! } ! /** * Do we need to drop constraints before dropping tables in this dialect? * @return boolean */ ! public boolean dropConstraints() { ! return true; ! } ! /** * Do we need to qualify index names with the schema name? * @return boolean */ ! public boolean qualifyIndexName() { ! return true; ! } ! /** * Does this dialect support the <tt>FOR UPDATE</tt> syntax? * @return boolean */ ! public boolean supportsForUpdate() { ! return true; ! } ! /** * Does this dialect support the Oracle-style <tt>FOR UPDATE NOWAIT</tt> syntax? * @return boolean */ ! public boolean supportsForUpdateNowait() { ! return false; ! } ! /** * Does this dialect support the <tt>UNIQUE</tt> column syntax? *************** *** 150,154 **** return true; } ! /** * The syntax used to add a column to a table. --- 150,154 ---- return true; } ! /** * The syntax used to add a column to a table. *************** *** 156,241 **** * @return String */ ! public abstract String getAddColumnString(); ! /** * The syntax used to add a foreign key constraint to a table. * @return String */ ! public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { ! return new StringBuffer(30) ! .append(" add constraint ") ! .append(constraintName) ! .append(" foreign key (") ! .append( StringHelper.join(", ", foreignKey) ) ! .append(") references ") ! .append(referencedTable) ! .toString(); ! } ! /** * The syntax used to add a primary key constraint to a table. * @return String */ ! public String getAddPrimaryKeyConstraintString(String constraintName) { ! return " add constraint " + constraintName + " primary key "; ! } ! /** * The keyword used to specify a nullable column. * @return String */ ! public String getNullColumnString() { ! return ""; ! } ! /** * Does this dialect support identity column key generation? * @return boolean */ ! public boolean supportsIdentityColumns() { ! return false; ! } ! ! public Serializable getIdentityFrom(ResultSet rs) throws SQLException { ! return new Long( rs.getLong(1) ); ! } ! /** ! * The syntax that returns the identity value of the last insert, if native ! * key generation is supported. ! * @throws MappingException if no native key generation ! */ ! public String getIdentitySelectString() throws MappingException { ! throw new MappingException("Dialect does not support native key generation"); ! } ! /** ! * The keyword used to specify an identity column, if native key generation is ! * supported. ! * @throws MappingException if no native key generation ! */ ! public String getIdentityColumnString() throws MappingException { ! throw new MappingException("Dialect does not support native key generation"); ! } /** * The keyword used to insert a generated value into an identity column (or null) * @return String */ ! public String getIdentityInsertString() { ! return null; ! } ! /** ! * The keyword used to insert a row without specifying any column values ! */ ! public String getNoColumnsInsertString() { ! return "values ( )"; ! } /** ! * The syntax that fetches the next value of a sequence, if sequences are supported. * @param sequenceName the name of the sequence * @return String * @throws MappingException if no sequences */ ! public String getSequenceNextValString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } /** * The syntax used to create a sequence, if sequences are supported. --- 156,241 ---- * @return String */ ! public abstract String getAddColumnString(); ! /** * The syntax used to add a foreign key constraint to a table. * @return String */ ! public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { ! return new StringBuffer(30) ! .append(" add constraint ") ! .append(constraintName) ! .append(" foreign key (") ! .append( StringHelper.join(", ", foreignKey) ) ! .append(") references ") ! .append(referencedTable) ! .toString(); ! } ! /** * The syntax used to add a primary key constraint to a table. * @return String */ ! public String getAddPrimaryKeyConstraintString(String constraintName) { ! return " add constraint " + constraintName + " primary key "; ! } ! /** * The keyword used to specify a nullable column. * @return String */ ! public String getNullColumnString() { ! return ""; ! } ! /** * Does this dialect support identity column key generation? * @return boolean */ ! public boolean supportsIdentityColumns() { ! return false; ! } ! ! public Serializable getIdentityFrom(ResultSet rs) throws SQLException { ! return new Long( rs.getLong(1) ); ! } ! /** ! * The syntax that returns the identity value of the last insert, if native ! * key generation is supported. ! * @throws MappingException if no native key generation ! */ ! public String getIdentitySelectString() throws MappingException { ! throw new MappingException("Dialect does not support native key generation"); ! } ! /** ! * The keyword used to specify an identity column, if native key generation is ! * supported. ! * @throws MappingException if no native key generation ! */ ! public String getIdentityColumnString() throws MappingException { ! throw new MappingException("Dialect does not support native key generation"); ! } /** * The keyword used to insert a generated value into an identity column (or null) * @return String */ ! public String getIdentityInsertString() { ! return null; ! } /** ! * The keyword used to insert a row without specifying any column values ! */ ! public String getNoColumnsInsertString() { ! return "values ( )"; ! } ! /** ! * The syntax that fetches the next value of a sequence, if sequences are supported. * @param sequenceName the name of the sequence * @return String * @throws MappingException if no sequences */ ! public String getSequenceNextValString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } /** * The syntax used to create a sequence, if sequences are supported. *************** *** 244,250 **** * @throws MappingException if no sequences */ ! public String getCreateSequenceString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } /** * The syntax used to drop a sequence, if sequences are supported. --- 244,250 ---- * @throws MappingException if no sequences */ ! public String getCreateSequenceString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } /** * The syntax used to drop a sequence, if sequences are supported. *************** *** 253,263 **** * @throws MappingException if no sequences */ ! public String getDropSequenceString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } ! public String getQuerySequencesString() { ! return null; ! } ! /** * Get the <tt>Dialect</tt> specified by the current <tt>System</tt> properties. --- 253,263 ---- * @throws MappingException if no sequences */ ! public String getDropSequenceString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } ! public String getQuerySequencesString() { ! return null; ! } ! /** * Get the <tt>Dialect</tt> specified by the current <tt>System</tt> properties. *************** *** 278,283 **** } } ! ! /** * Get the <tt>Dialect</tt> specified by the given properties or system properties. --- 278,283 ---- } } ! ! /** * Get the <tt>Dialect</tt> specified by the given properties or system properties. *************** *** 315,319 **** return ""; } ! /** * Get the <tt>OuterJoinGenerator</tt> need to implement outer joins for this dialect. --- 315,319 ---- return ""; } ! /** * Get the <tt>OuterJoinGenerator</tt> need to implement outer joins for this dialect. *************** *** 325,327 **** --- 325,330 ---- } + + + Index: GenericDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/GenericDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** GenericDialect.java 1 Jan 2003 13:54:13 -0000 1.1.1.1 --- GenericDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 5,13 **** ! /** * A generic SQL dialect which may or may not work on any actual databases */ public class GenericDialect extends Dialect { ! public GenericDialect() { super(); --- 5,13 ---- ! /** * A generic SQL dialect which may or may not work on any actual databases */ public class GenericDialect extends Dialect { ! public GenericDialect() { super(); *************** *** 33,36 **** return "add column"; } ! } --- 33,39 ---- return "add column"; } ! } + + + Index: HSQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/HSQLDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HSQLDialect.java 1 Jan 2003 13:54:14 -0000 1.1.1.1 --- HSQLDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 11,37 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect compatible with HSQLDB (Hypersonic SQL). */ public class HSQLDialect extends Dialect { ! public HSQLDialect() { super(); register( Types.BIGINT, "BIGINT" ); register( Types.BINARY, "BINARY" ); ! register( Types.BIT, "BIT" ); register( Types.CHAR, "CHAR(1)" ); register( Types.DATE, "DATE" ); ! register( Types.DECIMAL, "DECIMAL" ); register( Types.DOUBLE, "DOUBLE" ); register( Types.FLOAT, "FLOAT" ); ! register( Types.INTEGER, "INTEGER" ); ! register( Types.LONGVARBINARY, "LONGVARBINARY" ); ! register( Types.LONGVARCHAR, "LONGVARCHAR" ); ! register( Types.SMALLINT, "SMALLINT" ); register( Types.TINYINT, "TINYINT" ); ! register( Types.TIME, "TIME" ); register( Types.TIMESTAMP, "TIMESTAMP" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); register( Types.VARBINARY, "VARBINARY($l)" ); register( Types.NUMERIC, "NUMERIC" ); --- 11,37 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect compatible with HSQLDB (Hypersonic SQL). */ public class HSQLDialect extends Dialect { ! public HSQLDialect() { super(); register( Types.BIGINT, "BIGINT" ); register( Types.BINARY, "BINARY" ); ! register( Types.BIT, "BIT" ); register( Types.CHAR, "CHAR(1)" ); register( Types.DATE, "DATE" ); ! register( Types.DECIMAL, "DECIMAL" ); register( Types.DOUBLE, "DOUBLE" ); register( Types.FLOAT, "FLOAT" ); ! register( Types.INTEGER, "INTEGER" ); ! register( Types.LONGVARBINARY, "LONGVARBINARY" ); ! register( Types.LONGVARCHAR, "LONGVARCHAR" ); ! register( Types.SMALLINT, "SMALLINT" ); register( Types.TINYINT, "TINYINT" ); ! register( Types.TIME, "TIME" ); register( Types.TIMESTAMP, "TIMESTAMP" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); register( Types.VARBINARY, "VARBINARY($l)" ); register( Types.NUMERIC, "NUMERIC" ); *************** *** 47,51 **** public boolean hasAlterTable(){ return false; ! } public boolean dropConstraints() { --- 47,51 ---- public boolean hasAlterTable(){ return false; ! } public boolean dropConstraints() { *************** *** 53,81 **** } ! public Serializable getIdentityFrom(ResultSet rs) throws SQLException { ! return new Integer( rs.getInt(1) ); ! } ! ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentityColumnString() { ! return "NOT NULL IDENTITY"; ! } ! public String getIdentitySelectString() { ! return "call IDENTITY()"; ! } ! public String getIdentityInsertString() { ! return "null"; ! } ! public boolean supportsForUpdate() { return false; } - public boolean supportsUnique() { - return false; - } - } --- 53,84 ---- } ! public Serializable getIdentityFrom(ResultSet rs) throws SQLException { ! return new Integer( rs.getInt(1) ); ! } ! ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentityColumnString() { ! return "NOT NULL IDENTITY"; ! } ! public String getIdentitySelectString() { ! return "call IDENTITY()"; ! } ! public String getIdentityInsertString() { ! return "null"; ! } ! public boolean supportsForUpdate() { return false; } + + public boolean supportsUnique() { + return false; + } + + + } Index: InterbaseDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/InterbaseDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** InterbaseDialect.java 1 Jan 2003 13:54:14 -0000 1.1.1.1 --- InterbaseDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,10 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect for Interbase. */ --- 6,10 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect for Interbase. */ *************** *** 33,39 **** getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); getDefaultProperties().setProperty(Environment.STATEMENT_CACHE_SIZE, "0"); ! } ! public String getAddColumnString() { return "add"; --- 33,39 ---- getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); getDefaultProperties().setProperty(Environment.STATEMENT_CACHE_SIZE, "0"); ! } ! public String getAddColumnString() { return "add"; *************** *** 45,51 **** return "create generator " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase() + "'"; ! } ! } \ No newline at end of file --- 45,53 ---- return "create generator " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase() + "'"; ! } ! } ! ! Index: MckoiDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/MckoiDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MckoiDialect.java 1 Jan 2003 13:54:14 -0000 1.1.1.1 --- MckoiDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 31,35 **** getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); } ! public String getAddColumnString() { return "add column"; --- 31,35 ---- getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); } ! public String getAddColumnString() { return "add column"; *************** *** 48,49 **** --- 48,52 ---- } } + + + Index: MySQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/MySQLDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MySQLDialect.java 1 Jan 2003 13:54:14 -0000 1.1.1.1 --- MySQLDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 7,11 **** import net.sf.hibernate.util.StringHelper; ! /** * An SQL dialect for MySQL. */ --- 7,11 ---- import net.sf.hibernate.util.StringHelper; ! /** * An SQL dialect for MySQL. */ *************** *** 39,47 **** register( Types.CLOB, 16777215, "MEDIUMTEXT" ); register( Types.CLOB, 65535, "TEXT" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); } ! public String getAddColumnString() { return "add column"; --- 39,47 ---- register( Types.CLOB, 16777215, "MEDIUMTEXT" ); register( Types.CLOB, 65535, "TEXT" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); } ! public String getAddColumnString() { return "add column"; *************** *** 53,85 **** return false; } - public boolean supportsIdentityColumns() { - return true; - } - public String getIdentitySelectString() { - return "SELECT LAST_INSERT_ID()"; - } - - public String getIdentityColumnString() { - return "NOT NULL AUTO_INCREMENT"; - } - public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { - String cols = StringHelper.join(", ", foreignKey); - return new StringBuffer(30) - .append(" add index (") - .append(cols) - .append("), add constraint ") - .append(constraintName) - .append(" foreign key (") - .append(cols) - .append(") references ") - .append(referencedTable) - .append(" (") - .append( StringHelper.join(", ", primaryKey) ) - .append(')') - .toString(); - } - } --- 53,88 ---- return false; } + + public boolean supportsIdentityColumns() { + return true; + } + public String getIdentitySelectString() { + return "SELECT LAST_INSERT_ID()"; + } + + public String getIdentityColumnString() { + return "NOT NULL AUTO_INCREMENT"; + } + + public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { + String cols = StringHelper.join(", ", foreignKey); + return new StringBuffer(30) + .append(" add index (") + .append(cols) + .append("), add constraint ") + .append(constraintName) + .append(" foreign key (") + .append(cols) + .append(") references ") + .append(referencedTable) + .append(" (") + .append( StringHelper.join(", ", primaryKey) ) + .append(')') + .toString(); + } + + } Index: OracleDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/OracleDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** OracleDialect.java 1 Jan 2003 13:54:15 -0000 1.1.1.1 --- OracleDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 8,19 **** import net.sf.hibernate.loader.OracleOuterJoinGenerator; ! /** * An SQL dialect for Oracle. */ public class OracleDialect extends Dialect { ! private final OuterJoinGenerator outerJoinGenerator; ! public OracleDialect() { super(); --- 8,19 ---- import net.sf.hibernate.loader.OracleOuterJoinGenerator; ! /** * An SQL dialect for Oracle. */ public class OracleDialect extends Dialect { ! private final OuterJoinGenerator outerJoinGenerator; ! public OracleDialect() { super(); *************** *** 34,45 **** register( Types.BLOB, "BLOB" ); register( Types.CLOB, "CLOB" ); ! outerJoinGenerator = new OracleOuterJoinGenerator(); ! getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); } ! public String getAddColumnString() { return "add"; --- 34,45 ---- register( Types.BLOB, "BLOB" ); register( Types.CLOB, "CLOB" ); ! outerJoinGenerator = new OracleOuterJoinGenerator(); ! getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); } ! public String getAddColumnString() { return "add"; *************** *** 52,72 **** return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! public String getCascadeConstraintsString() { return " cascade constraints"; } ! public OuterJoinGenerator getOuterJoinGenerator() { return outerJoinGenerator; } - public boolean supportsForUpdateNowait() { - return true; - } - } --- 52,75 ---- return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! public String getCascadeConstraintsString() { return " cascade constraints"; } ! public OuterJoinGenerator getOuterJoinGenerator() { return outerJoinGenerator; } + + public boolean supportsForUpdateNowait() { + return true; + } + + } + Index: PointbaseDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/PointbaseDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PointbaseDialect.java 1 Jan 2003 13:54:15 -0000 1.1.1.1 --- PointbaseDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 12,42 **** */ public class PointbaseDialect extends net.sf.hibernate.dialect.Dialect { ! ! /** Creates new PointbaseDialect */ ! public PointbaseDialect() { ! super(); ! register( Types.BIT, "SMALLINT" ); //no pointbase BIT ! register( Types.BIGINT, "BIGINT" ); ! register( Types.SMALLINT, "SMALLINT" ); ! register( Types.TINYINT, "SMALLINT" ); //no pointbase TINYINT ! register( Types.INTEGER, "INTEGER" ); ! register( Types.CHAR, "CHAR(1)" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); ! register( Types.FLOAT, "FLOAT" ); ! register( Types.DOUBLE, "DOUBLE PRECISION" ); ! register( Types.DATE, "DATE" ); ! register( Types.TIME, "TIME" ); ! register( Types.TIMESTAMP, "TIMESTAMP" ); ! //the BLOB type requires a size arguement - this defaults to ! //bytes - no arg defaults to 1 whole byte! ! //other argument mods include K - kilobyte, M - megabyte, G - gigabyte. ! //refer to the PBdevelopers guide for more info. ! register( Types.VARBINARY, "BLOB($l)" ); ! register( Types.NUMERIC, "NUMERIC(19, $l)" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); ! } ! /** * @see net.sf.hibernate.sql.Dialect#getAddColumnString() --- 12,42 ---- */ public class PointbaseDialect extends net.sf.hibernate.dialect.Dialect { ! ! /** Creates new PointbaseDialect */ ! public PointbaseDialect() { ! super(); ! register( Types.BIT, "SMALLINT" ); //no pointbase BIT ! register( Types.BIGINT, "BIGINT" ); ! register( Types.SMALLINT, "SMALLINT" ); ! register( Types.TINYINT, "SMALLINT" ); //no pointbase TINYINT ! register( Types.INTEGER, "INTEGER" ); ! register( Types.CHAR, "CHAR(1)" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); ! register( Types.FLOAT, "FLOAT" ); ! register( Types.DOUBLE, "DOUBLE PRECISION" ); ! register( Types.DATE, "DATE" ); ! register( Types.TIME, "TIME" ); ! register( Types.TIMESTAMP, "TIMESTAMP" ); ! //the BLOB type requires a size arguement - this defaults to ! //bytes - no arg defaults to 1 whole byte! ! //other argument mods include K - kilobyte, M - megabyte, G - gigabyte. ! //refer to the PBdevelopers guide for more info. ! register( Types.VARBINARY, "BLOB($l)" ); ! register( Types.NUMERIC, "NUMERIC(19, $l)" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); ! } ! /** * @see net.sf.hibernate.sql.Dialect#getAddColumnString() *************** *** 45,49 **** return "add"; } ! /** * @see net.sf.hibernate.sql.Dialect#dropConstraints() --- 45,49 ---- return "add"; } ! /** * @see net.sf.hibernate.sql.Dialect#dropConstraints() *************** *** 52,56 **** return false; } ! /** * @see net.sf.hibernate.sql.Dialect#getCascadeConstraintsString() --- 52,56 ---- return false; } ! /** * @see net.sf.hibernate.sql.Dialect#getCascadeConstraintsString() *************** *** 59,63 **** return " cascade"; } ! /** * @see net.sf.hibernate.sql.Dialect#supportsForUpdate() --- 59,63 ---- return " cascade"; } ! /** * @see net.sf.hibernate.sql.Dialect#supportsForUpdate() *************** *** 66,70 **** return false; } ! } --- 66,73 ---- return false; } ! } + + + Index: PostgreSQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/PostgreSQLDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PostgreSQLDialect.java 1 Jan 2003 13:54:15 -0000 1.1.1.1 --- PostgreSQLDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,10 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect for Postgres */ --- 6,10 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect for Postgres */ *************** *** 31,35 **** getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); } ! public String getAddColumnString() { return "add column"; --- 31,35 ---- getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); } ! public String getAddColumnString() { return "add column"; *************** *** 38,55 **** return false; } ! public String getSequenceNextValString(String sequenceName) { ! return "select nextval ('" + sequenceName +"')"; ! } public String getCreateSequenceString(String sequenceName) { return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! public String getCascadeConstraintsString() { return " cascade"; } ! } --- 38,58 ---- return false; } ! public String getSequenceNextValString(String sequenceName) { ! return "select nextval ('" + sequenceName +"')"; ! } public String getCreateSequenceString(String sequenceName) { return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! public String getCascadeConstraintsString() { return " cascade"; } ! } + + + Index: ProgressDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/ProgressDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ProgressDialect.java 1 Jan 2003 13:54:15 -0000 1.1.1.1 --- ProgressDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 5,9 **** import java.sql.Types; ! /** * An SQL dialect compatible with Progress 9.1C<br> *<br> --- 5,9 ---- import java.sql.Types; ! /** * An SQL dialect compatible with Progress 9.1C<br> *<br> *************** *** 16,20 **** * <li>hibernate.password password *</ul> ! * The WorkArounds parameter in the URL is required to avoid an error * in the Progress 9.1C JDBC driver related to PreparedStatements. * --- 16,20 ---- * <li>hibernate.password password *</ul> ! * The WorkArounds parameter in the URL is required to avoid an error * in the Progress 9.1C JDBC driver related to PreparedStatements. * *************** *** 38,54 **** register( Types.NUMERIC, "NUMERIC(19,$l)" ); } ! public boolean hasAlterTable(){ return false; ! } ! public String getAddColumnString() { return "add column"; } ! ! public boolean qualifyIndexName() { ! return false; ! } } ! \ No newline at end of file --- 38,56 ---- register( Types.NUMERIC, "NUMERIC(19,$l)" ); } ! public boolean hasAlterTable(){ return false; ! } ! public String getAddColumnString() { return "add column"; } ! ! public boolean qualifyIndexName() { ! return false; ! } } ! ! ! Index: SAPDBDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/SAPDBDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SAPDBDialect.java 1 Jan 2003 13:54:16 -0000 1.1.1.1 --- SAPDBDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 14,101 **** */ public class SAPDBDialect extends Dialect { ! private final OuterJoinGenerator outerJoinGenerator; ! ! public SAPDBDialect() { ! super(); ! register( Types.BIT, "BOOLEAN" ); ! register( Types.BIGINT, "FIXED(19,0)" ); ! register( Types.SMALLINT, "SMALLINT" ); ! register( Types.TINYINT, "FIXED(3,0)" ); ! register( Types.INTEGER, "INT" ); ! register( Types.CHAR, "CHAR(1)" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); ! register( Types.FLOAT, "FLOAT" ); ! register( Types.DOUBLE, "DOUBLE PRECISION" ); ! register( Types.DATE, "DATE" ); ! register( Types.TIME, "TIME" ); ! register( Types.TIMESTAMP, "TIMESTAMP" ); ! register( Types.VARBINARY, "LONG BYTE" ); ! register( Types.NUMERIC, "FIXED(19,$l)" ); ! register( Types.CLOB, "LONG VARCHAR" ); ! register( Types.BLOB, "LONG BYTE" ); ! outerJoinGenerator = new OracleOuterJoinGenerator(); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); ! ! } ! ! public boolean hasAlterTable() { ! return true; ! } ! ! public boolean supportsForUpdate() { ! return false; ! } ! ! public boolean dropConstraints() { ! return false; ! } ! ! public String getAddColumnString() { ! return "add"; ! } ! ! public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { ! return new StringBuffer(30) ! .append(" foreign key ") ! .append(constraintName) ! .append(" (") ! .append( StringHelper.join(", ", foreignKey) ) ! .append(") references ") ! .append(referencedTable) ! .toString(); ! } ! ! public String getAddPrimaryKeyConstraintString(String constraintName) { ! return " primary key "; ! } ! ! public String getNullColumnString() { ! return " null"; ! } ! ! public String getSequenceNextValString(String sequenceName) { ! return "select " + sequenceName + ".nextval from dual"; ! } ! ! public String getCreateSequenceString(String sequenceName) { ! return "create sequence " + sequenceName; ! } ! ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! ! public String getQuerySequencesString() ! { ! return "select SEQUENCE_NAME from DOMAIN.SEQUENCES"; ! } ! public OuterJoinGenerator getOuterJoinGenerator() { return outerJoinGenerator; } - } \ No newline at end of file --- 14,103 ---- */ public class SAPDBDialect extends Dialect { ! private final OuterJoinGenerator outerJoinGenerator; ! ! public SAPDBDialect() { ! super(); ! register( Types.BIT, "BOOLEAN" ); ! register( Types.BIGINT, "FIXED(19,0)" ); ! register( Types.SMALLINT, "SMALLINT" ); ! register( Types.TINYINT, "FIXED(3,0)" ); ! register( Types.INTEGER, "INT" ); ! register( Types.CHAR, "CHAR(1)" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); ! register( Types.FLOAT, "FLOAT" ); ! register( Types.DOUBLE, "DOUBLE PRECISION" ); ! register( Types.DATE, "DATE" ); ! register( Types.TIME, "TIME" ); ! register( Types.TIMESTAMP, "TIMESTAMP" ); ! register( Types.VARBINARY, "LONG BYTE" ); ! register( Types.NUMERIC, "FIXED(19,$l)" ); ! register( Types.CLOB, "LONG VARCHAR" ); ! register( Types.BLOB, "LONG BYTE" ); ! outerJoinGenerator = new OracleOuterJoinGenerator(); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); ! ! } ! ! public boolean hasAlterTable() { ! return true; ! } ! ! public boolean supportsForUpdate() { ! return false; ! } ! ! public boolean dropConstraints() { ! return false; ! } ! ! public String getAddColumnString() { ! return "add"; ! } ! ! public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { ! return new StringBuffer(30) ! .append(" foreign key ") ! .append(constraintName) ! .append(" (") ! .append( StringHelper.join(", ", foreignKey) ) ! .append(") references ") ! .append(referencedTable) ! .toString(); ! } ! ! public String getAddPrimaryKeyConstraintString(String constraintName) { ! return " primary key "; ! } ! ! public String getNullColumnString() { ! return " null"; ! } ! ! public String getSequenceNextValString(String sequenceName) { ! return "select " + sequenceName + ".nextval from dual"; ! } ! ! public String getCreateSequenceString(String sequenceName) { ! return "create sequence " + sequenceName; ! } ! ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! ! public String getQuerySequencesString() ! { ! return "select SEQUENCE_NAME from DOMAIN.SEQUENCES"; ! } ! public OuterJoinGenerator getOuterJoinGenerator() { return outerJoinGenerator; } + + } + Index: SybaseDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/SybaseDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SybaseDialect.java 1 Jan 2003 13:54:16 -0000 1.1.1.1 --- SybaseDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,10 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect compatible with Sybase and MS SQL Server. */ --- 6,10 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect compatible with Sybase and MS SQL Server. */ *************** *** 29,37 **** register( Types.BLOB, "IMAGE" ); register( Types.CLOB, "TEXT" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); } ! public String getAddColumnString() { return "add"; --- 29,37 ---- register( Types.BLOB, "IMAGE" ); register( Types.CLOB, "TEXT" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); } ! public String getAddColumnString() { return "add"; *************** *** 47,64 **** return false; } ! ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentitySelectString() { ! return "select @@identity"; ! } ! public String getIdentityColumnString() { ! return "IDENTITY NOT NULL"; ! } ! public String getNoColumnsInsertString() { return "DEFAULT VALUES"; } - } \ No newline at end of file --- 47,66 ---- return false; } ! ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentitySelectString() { ! return "select @@identity"; ! } ! public String getIdentityColumnString() { ! return "IDENTITY NOT NULL"; ! } ! public String getNoColumnsInsertString() { return "DEFAULT VALUES"; } + + } + Index: TypeNames.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/TypeNames.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TypeNames.java 1 Jan 2003 13:54:17 -0000 1.1.1.1 --- TypeNames.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 45,49 **** private HashMap weighted = new HashMap(); private HashMap defaults = new HashMap(); ! /** * Constructor. --- 45,49 ---- private HashMap weighted = new HashMap(); private HashMap defaults = new HashMap(); ! /** * Constructor. *************** *** 52,59 **** public TypeNames(String placeholder) { super(); ! this.placeholder = placeholder; } ! /** * get default type name for specified type --- 52,59 ---- public TypeNames(String placeholder) { super(); ! this.placeholder = placeholder; } ! /** * get default type name for specified type *************** *** 61,68 **** * @return the default type name associated with specified key */ ! public String get(int typecode) { ! return (String) defaults.get( new Integer(typecode) ); ! } ! /** * get type name for specified type and size --- 61,68 ---- * @return the default type name associated with specified key */ ! public String get(int typecode) { ! return (String) defaults.get( new Integer(typecode) ); ! } ! /** * get type name for specified type and size *************** *** 72,82 **** * if available and the default type name otherwise */ ! public String get(int typecode, int size) { ! Map map = (Map) weighted.get( new Integer(typecode) ); ! if (map != null && map.size() > 0) { ! // iterate entries ordered by capacity to find first fit ! Iterator entries = map.entrySet().iterator(); ! while (entries.hasNext()) { ! Map.Entry entry = (Map.Entry)entries.next(); if (size <= ((Integer)entry.getKey()).intValue()) { return StringHelper.replaceOnce( --- 72,82 ---- * if available and the default type name otherwise */ ! public String get(int typecode, int size) { ! Map map = (Map) weighted.get( new Integer(typecode) ); ! if (map != null && map.size() > 0) { ! // iterate entries ordered by capacity to find first fit ! Iterator entries = map.entrySet().iterator(); ! while (entries.hasNext()) { ! Map.Entry entry = (Map.Entry)entries.next(); if (size <= ((Integer)entry.getKey()).intValue()) { return StringHelper.replaceOnce( *************** *** 86,94 **** ); } ! } ! } ! return StringHelper.replaceOnce( get(typecode), placeholder, Integer.toString(size) ); ! } ! /** * set a type name for specified type key and capacity --- 86,94 ---- ); } ! } ! } ! return StringHelper.replaceOnce( get(typecode), placeholder, Integer.toString(size) ); ! } ! /** * set a type name for specified type key and capacity *************** *** 96,105 **** */ public void put(int typecode, int capacity, String value) { ! TreeMap map = (TreeMap)weighted.get( new Integer(typecode) ); ! if (map == null) // add new ordered map ! weighted.put( new Integer(typecode), map = new TreeMap() ); ! map.put(new Integer(capacity), value); ! } ! /** * set a default type name for specified type key --- 96,105 ---- */ public void put(int typecode, int capacity, String value) { ! TreeMap map = (TreeMap)weighted.get( new Integer(typecode) ); ! if (map == null) // add new ordered map ! weighted.put( new Integer(typecode), map = new TreeMap() ); ! map.put(new Integer(capacity), value); ! } ! /** * set a default type name for specified type key *************** *** 108,111 **** public void put(int typecode, String value) { defaults.put( new Integer(typecode), value ); ! } } --- 108,114 ---- public void put(int typecode, String value) { defaults.put( new Integer(typecode), value ); ! } } + + + |
From: <one...@us...> - 2003-01-04 11:16:02
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/jmx Modified Files: HibernateService.java HibernateServiceMBean.java SessionFactoryStub.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: HibernateService.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/HibernateService.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HibernateService.java 1 Jan 2003 13:56:05 -0000 1.1.1.1 --- HibernateService.java 4 Jan 2003 11:15:29 -0000 1.2 *************** *** 28,36 **** private static final Log log = LogFactory.getLog(HibernateServiceMBean.class); ! private final Properties props = new Properties(); private String mapResources; private String boundName; ! /** * The name of the current bean --- 28,36 ---- private static final Log log = LogFactory.getLog(HibernateServiceMBean.class); ! private final Properties props = new Properties(); private String mapResources; private String boundName; ! /** * The name of the current bean *************** *** 40,44 **** return props.getProperty(Environment.SESSION_FACTORY_NAME); } ! public String getMapResources() { return mapResources; --- 40,44 ---- return props.getProperty(Environment.SESSION_FACTORY_NAME); } ! public String getMapResources() { return mapResources; *************** *** 57,61 **** } } ! public String getDatasource() { return props.getProperty(Environment.DATASOURCE); --- 57,61 ---- } } ! public String getDatasource() { return props.getProperty(Environment.DATASOURCE); *************** *** 69,73 **** return props.getProperty(Environment.DIALECT); } ! public void setDialect(String dialect) { props.setProperty(Environment.DIALECT, dialect); --- 69,73 ---- return props.getProperty(Environment.DIALECT); } ! public void setDialect(String dialect) { props.setProperty(Environment.DIALECT, dialect); *************** *** 90,103 **** props.setProperty( Environment.OUTER_JOIN, uoj ? "true" : "false" ); //Boolean.toString() only in JDK1.4 } ! ! public boolean getShowSql() { ! String prop = props.getProperty(Environment.SHOW_SQL); return Boolean.valueOf(prop).booleanValue(); ! } ! ! public void setShowSql(boolean showSql) { ! props.setProperty(Environment.SHOW_SQL, showSql ? "true" : "false"); ! } ! public String getUserName() { return props.getProperty(Environment.USER); --- 90,103 ---- props.setProperty( Environment.OUTER_JOIN, uoj ? "true" : "false" ); //Boolean.toString() only in JDK1.4 } ! ! public boolean getShowSql() { ! String prop = props.getProperty(Environment.SHOW_SQL); return Boolean.valueOf(prop).booleanValue(); ! } ! ! public void setShowSql(boolean showSql) { ! props.setProperty(Environment.SHOW_SQL, showSql ? "true" : "false"); ! } ! public String getUserName() { return props.getProperty(Environment.USER); *************** *** 115,123 **** props.setProperty(Environment.PASS, password); } ! private String[] parseResourceList(String resourceList) { return PropertiesHelper.toStringArray(resourceList, ", "); } ! public void start() throws HibernateException { boundName = getJndiName(); --- 115,123 ---- props.setProperty(Environment.PASS, password); } ! private String[] parseResourceList(String resourceList) { return PropertiesHelper.toStringArray(resourceList, ", "); } ! public void start() throws HibernateException { boundName = getJndiName(); *************** *** 127,132 **** catch (HibernateException he) { log.info("Could not build SessionFactory using the MBean classpath - will try again using client classpath"); ! String[] mappingFiles = parseResourceList( getMapResources() ); ! new SessionFactoryStub(mappingFiles, props); } } --- 127,132 ---- catch (HibernateException he) { log.info("Could not build SessionFactory using the MBean classpath - will try again using client classpath"); ! String[] mappingFiles = parseResourceList( getMapResources() ); ! new SessionFactoryStub(mappingFiles, props); } } *************** *** 134,150 **** public void stop() { log.info("stopping service"); ! try { ! new InitialContext().unbind(boundName); ! } ! catch (NamingException e) { ! log.warn("exception while unbinding factory from JNDI", e); ! } ! } ! private void bindSessionFactory() throws HibernateException { log.info("starting service at JNDI name: " + boundName); log.info("properties: " + props); Datastore ds = Hibernate.createDatastore(); ! String[] mappingFiles = parseResourceList( getMapResources() ); for ( int i=0; i<mappingFiles.length; i++ ) { log.info( "compiling mapping: " + mappingFiles[i] ); --- 134,150 ---- public void stop() { log.info("stopping service"); ! try { ! new InitialContext().unbind(boundName); ! } ! catch (NamingException e) { ! log.warn("exception while unbinding factory from JNDI", e); ! } ! } ! private void bindSessionFactory() throws HibernateException { log.info("starting service at JNDI name: " + boundName); log.info("properties: " + props); Datastore ds = Hibernate.createDatastore(); ! String[] mappingFiles = parseResourceList( getMapResources() ); for ( int i=0; i<mappingFiles.length; i++ ) { log.info( "compiling mapping: " + mappingFiles[i] ); *************** *** 153,161 **** ds.buildSessionFactory(props); } ! public String getTransactionStrategy() { return props.getProperty(Environment.TRANSACTION_STRATEGY); } ! public String getUserTransactionName() { return props.getProperty(Environment.USER_TRANSACTION); --- 153,161 ---- ds.buildSessionFactory(props); } ! public String getTransactionStrategy() { return props.getProperty(Environment.TRANSACTION_STRATEGY); } ! public String getUserTransactionName() { return props.getProperty(Environment.USER_TRANSACTION); *************** *** 164,188 **** props.setProperty(Environment.TRANSACTION_STRATEGY, txnStrategy); } ! public void setUserTransactionName(String utName) { props.setProperty(Environment.USER_TRANSACTION, utName); } ! public String getProperties() { return props.toString(); } ! public void setProperty(String property, String value) { props.setProperty(property, value); } ! public String getTransactionManagerLookupStrategy() { return props.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY); } ! public void setTransactionManagerLookupStrategy(String lkpStrategy) { props.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, lkpStrategy); } ! } --- 164,191 ---- props.setProperty(Environment.TRANSACTION_STRATEGY, txnStrategy); } ! public void setUserTransactionName(String utName) { props.setProperty(Environment.USER_TRANSACTION, utName); } ! public String getProperties() { return props.toString(); } ! public void setProperty(String property, String value) { props.setProperty(property, value); } ! public String getTransactionManagerLookupStrategy() { return props.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY); } ! public void setTransactionManagerLookupStrategy(String lkpStrategy) { props.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, lkpStrategy); } ! } + + + Index: HibernateServiceMBean.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/HibernateServiceMBean.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HibernateServiceMBean.java 1 Jan 2003 13:56:05 -0000 1.1.1.1 --- HibernateServiceMBean.java 4 Jan 2003 11:15:29 -0000 1.2 *************** *** 9,13 **** */ public interface HibernateServiceMBean { ! /** * The Hibernate mapping files (might be overridden by subclasses --- 9,13 ---- */ public interface HibernateServiceMBean { ! /** * The Hibernate mapping files (might be overridden by subclasses *************** *** 76,80 **** * @return String */ ! public String getDialect(); /** * The name of the dialect class to use in this <tt>SessionFactory</tt> --- 76,80 ---- * @return String */ ! public String getDialect(); /** * The name of the dialect class to use in this <tt>SessionFactory</tt> *************** *** 101,105 **** */ public String getTransactionStrategy(); ! /** * Set the fully qualified class name of the Hibernate <tt>TransactionFactory</tt> implementation --- 101,105 ---- */ public String getTransactionStrategy(); ! /** * Set the fully qualified class name of the Hibernate <tt>TransactionFactory</tt> implementation *************** *** 108,112 **** */ public void setTransactionStrategy(String txnStrategy); ! /** * The JNDI name of the JTA UserTransaction object (used only be <tt>JTATransaction</tt>). --- 108,112 ---- */ public void setTransactionStrategy(String txnStrategy); ! /** * The JNDI name of the JTA UserTransaction object (used only be <tt>JTATransaction</tt>). *************** *** 144,159 **** */ public void setUseOuterJoin(boolean uoj); ! ! /** ! * Is SQL logging enabled? ! * @return boolean ! */ ! public boolean getShowSql(); ! /** ! * Enable logging of SQL to console ! * @param boolean ! */ ! public void setShowSql(boolean showSql); ! /** * Create the <tt>SessionFactory</tt> and bind to the jndi name on startup --- 144,159 ---- */ public void setUseOuterJoin(boolean uoj); ! ! /** ! * Is SQL logging enabled? ! * @return boolean ! */ ! public boolean getShowSql(); ! /** ! * Enable logging of SQL to console ! * @param boolean ! */ ! public void setShowSql(boolean showSql); ! /** * Create the <tt>SessionFactory</tt> and bind to the jndi name on startup *************** *** 164,167 **** */ public void stop(); ! } --- 164,170 ---- */ public void stop(); ! } + + + Index: SessionFactoryStub.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/SessionFactoryStub.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SessionFactoryStub.java 1 Jan 2003 13:56:05 -0000 1.1.1.1 --- SessionFactoryStub.java 4 Jan 2003 11:15:29 -0000 1.2 *************** *** 43,47 **** private static final IdentifierGenerator uuidgen = new UUIDHexGenerator(); ! private transient SessionFactory impl; private transient String[] resources; --- 43,47 ---- private static final IdentifierGenerator uuidgen = new UUIDHexGenerator(); ! private transient SessionFactory impl; private transient String[] resources; *************** *** 49,53 **** private String uuid; private String name; ! SessionFactoryStub(String[] resources, Properties properties) { this.resources = resources; --- 49,53 ---- private String uuid; private String name; ! SessionFactoryStub(String[] resources, Properties properties) { this.resources = resources; *************** *** 63,67 **** SessionFactoryObjectFactory.addInstance(uuid, name, this, properties); } ! public Session openSession() throws SQLException { return getImpl().openSession(); --- 63,67 ---- SessionFactoryObjectFactory.addInstance(uuid, name, this, properties); } ! public Session openSession() throws SQLException { return getImpl().openSession(); *************** *** 73,77 **** return getImpl().openDatabinder(); } ! private synchronized SessionFactory getImpl() { if (impl==null) { --- 73,77 ---- return getImpl().openDatabinder(); } ! private synchronized SessionFactory getImpl() { if (impl==null) { *************** *** 90,94 **** return impl; } ! //readResolveObject Object readResolve() throws ObjectStreamException { --- 90,94 ---- return impl; } ! //readResolveObject Object readResolve() throws ObjectStreamException { *************** *** 111,115 **** return result; } ! /** * @see javax.naming.Referenceable#getReference() --- 111,115 ---- return result; } ! /** * @see javax.naming.Referenceable#getReference() *************** *** 125,153 **** public ClassMetadata getClassMetadata(Class persistentClass) ! throws HibernateException { return getImpl().getClassMetadata(persistentClass); } ! public CollectionMetadata getCollectionMetadata(String roleName) ! throws HibernateException { return getImpl().getCollectionMetadata(roleName); } ! public Session openSession(Connection connection, Interceptor interceptor) { return getImpl().openSession(connection, interceptor); } ! public Session openSession(Interceptor interceptor) throws SQLException { return getImpl().openSession(interceptor); } - public Map getAllClassMetadata() throws HibernateException { - return getImpl().getAllClassMetadata(); - } - - public Map getAllCollectionMetadata() throws HibernateException { - return getImpl().getAllCollectionMetadata(); - } - - } \ No newline at end of file --- 125,155 ---- public ClassMetadata getClassMetadata(Class persistentClass) ! throws HibernateException { return getImpl().getClassMetadata(persistentClass); } ! public CollectionMetadata getCollectionMetadata(String roleName) ! throws HibernateException { return getImpl().getCollectionMetadata(roleName); } ! public Session openSession(Connection connection, Interceptor interceptor) { return getImpl().openSession(connection, interceptor); } ! public Session openSession(Interceptor interceptor) throws SQLException { return getImpl().openSession(interceptor); } + + + public Map getAllClassMetadata() throws HibernateException { + return getImpl().getAllClassMetadata(); + } + + public Map getAllCollectionMetadata() throws HibernateException { + return getImpl().getAllCollectionMetadata(); + } + + } |
From: <one...@us...> - 2003-01-04 11:16:02
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/engine Modified Files: Batcher.java Cascades.java Key.java Mapping.java RowSelection.java SessionFactoryImplementor.java SessionImplementor.java TypedValue.java Versioning.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: Batcher.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/Batcher.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Batcher.java 1 Jan 2003 13:54:20 -0000 1.1.1.1 --- Batcher.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 28,32 **** /** ! * Get a non-batchable prepared statement to use for inserting / deleting / updating. * Must be explicitly released by <tt>closeStatement()</tt> */ --- 28,32 ---- /** ! * Get a non-batchable prepared statement to use for inserting / deleting / updating. * Must be explicitly released by <tt>closeStatement()</tt> */ *************** *** 59,62 **** */ public void closeStatements(); ! } --- 59,65 ---- */ public void closeStatements(); ! } + + + Index: Cascades.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/Cascades.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Cascades.java 3 Jan 2003 13:36:00 -0000 1.2 --- Cascades.java 4 Jan 2003 11:15:28 -0000 1.3 *************** *** 21,32 **** import net.sf.hibernate.type.Type; ! /** * Implements cascaded save / delete / update * @see net.sf.hibernate.type.AssociationType */ public final class Cascades { ! private static final Log log = LogFactory.getLog(Cascades.class); ! // The available cascade actions: --- 21,32 ---- import net.sf.hibernate.type.Type; ! /** * Implements cascaded save / delete / update * @see net.sf.hibernate.type.AssociationType */ public final class Cascades { ! private static final Log log = LogFactory.getLog(Cascades.class); ! // The available cascade actions: *************** *** 55,62 **** } boolean shouldCascadeCollection(Object collection) { ! return true; ! } ! }; ! /** * @see net.sf.hibernate.Session#saveOrUpdate(Object) --- 55,62 ---- } boolean shouldCascadeCollection(Object collection) { ! return true; ! } ! }; ! /** * @see net.sf.hibernate.Session#saveOrUpdate(Object) *************** *** 78,96 **** } }; ! // The types of children to cascade to: /** ! * A cascade point that occurs just after the insertion of the parent entity and * just before deletion */ public static final int CASCADE_AFTER_INSERT_BEFORE_DELETE = 1; /** ! * A cascade point that occurs just before the insertion of the parent entity and * just after deletion */ public static final int CASCADE_BEFORE_INSERT_AFTER_DELETE = 2; /** ! * A cascade point that occurs just after the insertion of the parent entity and * just before deletion, inside a collection */ --- 78,96 ---- } }; ! // The types of children to cascade to: /** ! * A cascade point that occurs just after the insertion of the parent entity and * just before deletion */ public static final int CASCADE_AFTER_INSERT_BEFORE_DELETE = 1; /** ! * A cascade point that occurs just before the insertion of the parent entity and * just after deletion */ public static final int CASCADE_BEFORE_INSERT_AFTER_DELETE = 2; /** ! * A cascade point that occurs just after the insertion of the parent entity and * just before deletion, inside a collection */ *************** *** 102,106 **** // The allowable cascade styles for a property: ! /** * A style of cascade that can be specified by the mapping for an association. --- 102,106 ---- // The allowable cascade styles for a property: ! /** * A style of cascade that can be specified by the mapping for an association. *************** *** 180,186 **** public static final IdentifierValue SAVE_ANY = new IdentifierValue() { public final boolean isUnsaved(Serializable id) { ! return true; ! } ! }; /** * Never assume the transient instance is newly instantiated --- 180,186 ---- public static final IdentifierValue SAVE_ANY = new IdentifierValue() { public final boolean isUnsaved(Serializable id) { ! return true; ! } ! }; /** * Never assume the transient instance is newly instantiated *************** *** 188,194 **** public static final IdentifierValue SAVE_NONE = new IdentifierValue() { public final boolean isUnsaved(Serializable id) { ! return false; ! } ! }; /** * Assume the transient instance is newly instantiated if the identifier --- 188,194 ---- public static final IdentifierValue SAVE_NONE = new IdentifierValue() { public final boolean isUnsaved(Serializable id) { ! return false; ! } ! }; /** * Assume the transient instance is newly instantiated if the identifier *************** *** 197,207 **** public static final IdentifierValue SAVE_NULL = new IdentifierValue() { public final boolean isUnsaved(Serializable id) { ! return id==null; ! } ! }; ! ! /** ! * Cascade an action to the child ! */ private static void cascade(SessionImplementor session, Object child, Type type, CascadingAction action, int cascadeTo) throws SQLException, HibernateException { if (child!=null) { --- 197,207 ---- public static final IdentifierValue SAVE_NULL = new IdentifierValue() { public final boolean isUnsaved(Serializable id) { ! return id==null; ! } ! }; ! ! /** ! * Cascade an action to the child ! */ private static void cascade(SessionImplementor session, Object child, Type type, CascadingAction action, int cascadeTo) throws SQLException, HibernateException { if (child!=null) { *************** *** 271,280 **** for ( int i=0; i<types.length; i++) { if ( cascadeStyles[i].doCascade(action) ) ! cascade( session, persister.getPropertyValue(parent,i), types[i], action, cascadeTo ); } if ( log.isTraceEnabled() ) log.trace( "done processing cascades for: " + persister.getClassName() ); } } ! } --- 271,283 ---- for ( int i=0; i<types.length; i++) { if ( cascadeStyles[i].doCascade(action) ) ! cascade( session, persister.getPropertyValue(parent,i), types[i], action, cascadeTo ); } if ( log.isTraceEnabled() ) log.trace( "done processing cascades for: " + persister.getClassName() ); } } ! } + + + Index: Key.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/Key.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Key.java 3 Jan 2003 13:36:00 -0000 1.2 --- Key.java 4 Jan 2003 11:15:28 -0000 1.3 *************** *** 9,13 **** /** ! * A globally unique identifier of an instance, consisting of the * user-visible identifier and the identifier space (eg. tablename). */ --- 9,13 ---- /** ! * A globally unique identifier of an instance, consisting of the * user-visible identifier and the identifier space (eg. tablename). */ *************** *** 15,19 **** private final Serializable id; private final Serializable identifierSpace; ! private Key(Serializable id, Serializable identifierSpace) { if (id==null) throw new AssertionFailure("null identifier"); --- 15,19 ---- private final Serializable id; private final Serializable identifierSpace; ! private Key(Serializable id, Serializable identifierSpace) { if (id==null) throw new AssertionFailure("null identifier"); *************** *** 47,51 **** return otherKey.identifierSpace.equals(this.identifierSpace) && otherKey.id.equals(this.id); } ! public int hashCode() { return id.hashCode(); } } --- 47,54 ---- return otherKey.identifierSpace.equals(this.identifierSpace) && otherKey.id.equals(this.id); } ! public int hashCode() { return id.hashCode(); } } + + + Index: Mapping.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/Mapping.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Mapping.java 1 Jan 2003 13:54:22 -0000 1.1.1.1 --- Mapping.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 17,18 **** --- 17,21 ---- } + + + Index: RowSelection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/RowSelection.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RowSelection.java 3 Jan 2003 13:36:00 -0000 1.1 --- RowSelection.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,32 **** private Integer maxRows; private Integer timeout; ! public void setFirstRow(Integer firstRow) { this.firstRow = firstRow; } ! public Integer getFirstRow() { return firstRow; } ! public void setMaxRows(Integer maxRows) { this.maxRows = maxRows; } ! public Integer getMaxRows() { return maxRows; } ! public void setTimeout(Integer timeout) { this.timeout = timeout; } ! public Integer getTimeout() { return timeout; } ! } \ No newline at end of file --- 6,34 ---- private Integer maxRows; private Integer timeout; ! public void setFirstRow(Integer firstRow) { this.firstRow = firstRow; } ! public Integer getFirstRow() { return firstRow; } ! public void setMaxRows(Integer maxRows) { this.maxRows = maxRows; } ! public Integer getMaxRows() { return maxRows; } ! public void setTimeout(Integer timeout) { this.timeout = timeout; } ! public Integer getTimeout() { return timeout; } ! } ! ! Index: SessionFactoryImplementor.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/SessionFactoryImplementor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SessionFactoryImplementor.java 3 Jan 2003 13:36:00 -0000 1.2 --- SessionFactoryImplementor.java 4 Jan 2003 11:15:28 -0000 1.3 *************** *** 14,18 **** import net.sf.hibernate.type.Type; ! /** * Defines the internal contract between the <tt>SessionFactory</tt> and other parts of * Hibernate such as implementors of <tt>Type</tt>. --- 14,18 ---- import net.sf.hibernate.type.Type; ! /** * Defines the internal contract between the <tt>SessionFactory</tt> and other parts of * Hibernate such as implementors of <tt>Type</tt>. *************** *** 51,55 **** */ public Dialect getDialect(); ! /** * Get the return types of a query --- 51,55 ---- */ public Dialect getDialect(); ! /** * Get the return types of a query *************** *** 61,65 **** * @return a collection of strings */ ! public Collection getNamedParameters(String queryString) throws HibernateException; /** * Obtain a JDBC connection --- 61,65 ---- * @return a collection of strings */ ! public Collection getNamedParameters(String queryString) throws HibernateException; /** * Obtain a JDBC connection *************** *** 99,100 **** --- 99,103 ---- public void setFetchSize(PreparedStatement statement) throws SQLException; } + + + Index: SessionImplementor.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/SessionImplementor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SessionImplementor.java 3 Jan 2003 13:36:00 -0000 1.2 --- SessionImplementor.java 4 Jan 2003 11:15:28 -0000 1.3 *************** *** 20,24 **** ! /** * Defines the internal contract between the <tt>Session</tt> and other parts of * Hibernate such as implementors of <tt>Type</tt> or <tt>ClassPersister</tt>. --- 20,24 ---- ! /** * Defines the internal contract between the <tt>Session</tt> and other parts of * Hibernate such as implementors of <tt>Type</tt> or <tt>ClassPersister</tt>. *************** *** 27,31 **** */ public interface SessionImplementor extends Session { ! /** * Get the pre-flush identifier of the collection --- 27,31 ---- */ public interface SessionImplementor extends Session { ! /** * Get the pre-flush identifier of the collection *************** *** 40,44 **** * Get the <tt>PersistentCollection</tt> object for an array */ ! public ArrayHolder getArrayHolder(Object array); /** * Register a <tt>PersistentCollection</tt> object for an array --- 40,44 ---- * Get the <tt>PersistentCollection</tt> object for an array */ ! public ArrayHolder getArrayHolder(Object array); /** * Register a <tt>PersistentCollection</tt> object for an array *************** *** 54,58 **** public void addInitializedCollection(PersistentCollection collection, CollectionPersister persister, Serializable id) throws HibernateException; /** ! * Set the "shallow dirty" status of the collection. Called when the collection detects that the * client is modifying it */ --- 54,58 ---- public void addInitializedCollection(PersistentCollection collection, CollectionPersister persister, Serializable id) throws HibernateException; /** ! * Set the "shallow dirty" status of the collection. Called when the collection detects that the * client is modifying it */ *************** *** 81,85 **** */ public Object immediateLoad(Class persistentClass, Serializable id) throws SQLException, HibernateException; ! /** * System time before the start of the transaction --- 81,85 ---- */ public Object immediateLoad(Class persistentClass, Serializable id) throws SQLException, HibernateException; ! /** * System time before the start of the transaction *************** *** 101,113 **** public void postInsert(Object object); /** ! * After actually deleting a row, record the fact that the instance no longer exists on the * database (needed for identity-column key generation) */ public void postDelete(Object object); ! /** * Execute a <tt>find()</tt> query */ ! public List find(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws SQLException, HibernateException; /** * Execute an <tt>iterate()</tt> query --- 101,113 ---- public void postInsert(Object object); /** ! * After actually deleting a row, record the fact that the instance no longer exists on the * database (needed for identity-column key generation) */ public void postDelete(Object object); ! /** * Execute a <tt>find()</tt> query */ ! public List find(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws SQLException, HibernateException; /** * Execute an <tt>iterate()</tt> query *************** *** 131,135 **** */ public ClassPersister getPersister(Object object) throws MappingException; ! /** * Add an uninitialized instance of an entity class, as a placeholder to ensure object identity. --- 131,135 ---- */ public ClassPersister getPersister(Object object) throws MappingException; ! /** * Add an uninitialized instance of an entity class, as a placeholder to ensure object identity. *************** *** 151,155 **** public Object getEntity(Key key); /** ! * Return the existing proxy associated with the given <tt>Key</tt>, or the * second argument (the entity associated with the key) if no proxy exists. */ --- 151,155 ---- public Object getEntity(Key key); /** ! * Return the existing proxy associated with the given <tt>Key</tt>, or the * second argument (the entity associated with the key) if no proxy exists. */ *************** *** 157,161 **** /** ! * Notify the session that the transaction completed, so we no longer * own the old locks. (Also we should release cache softlocks.) */ --- 157,161 ---- /** ! * Notify the session that the transaction completed, so we no longer * own the old locks. (Also we should release cache softlocks.) */ *************** *** 168,170 **** --- 168,173 ---- } + + + Index: TypedValue.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/TypedValue.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TypedValue.java 3 Jan 2003 13:36:00 -0000 1.1 --- TypedValue.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 8,31 **** private Type type; private Object value; ! public TypedValue(Type t, Object o) { setType(t); value=o; } ! public void setValue(Object value) { this.value = value; } ! public Object getValue() { return value; } ! public void setType(Type type) { this.type = type; } ! public Type getType() { return type; } - } \ No newline at end of file --- 8,33 ---- private Type type; private Object value; ! public TypedValue(Type t, Object o) { setType(t); value=o; } ! public void setValue(Object value) { this.value = value; } ! public Object getValue() { return value; } ! public void setType(Type type) { this.type = type; } ! public Type getType() { return type; } + + } + Index: Versioning.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/Versioning.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Versioning.java 1 Jan 2003 13:54:23 -0000 1.1.1.1 --- Versioning.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 68,71 **** return persister.isVersioned() ? getVersion( fields, persister.getVersionProperty(), persister.getVersionType() ) : null; } ! } --- 68,74 ---- return persister.isVersioned() ? getVersion( fields, persister.getVersionProperty(), persister.getVersionType() ) : null; } ! } + + + |
From: <one...@us...> - 2003-01-04 11:16:01
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/eg In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/eg Modified Files: Edge.java NetworkDemo.java Source.java Vertex.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: Edge.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/eg/Edge.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Edge.java 1 Jan 2003 13:54:17 -0000 1.1.1.1 --- Edge.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 12,72 **** private long key; private Date creationDate = new Date(); ! public float getCapacity() { return capacity; } ! public void setCapacity(float capacity) { this.capacity = capacity; } ! public float getLength() { return length; } ! public void setLength(float length) { this.length = length; } ! public String getName() { return name; } ! public void setName(String name) { this.name = name; } ! public Vertex getSource() { return source; } ! void setSource(Vertex source) { this.source = source; } ! public Vertex getSink() { return sink; } ! void setSink(Vertex sink) { this.sink = sink; } ! public long getKey() { return key; } ! private void setKey(long key) { this.key = key; } ! public Date getCreationDate() { return creationDate; } ! private void setCreationDate(Date creationDate) { this.creationDate = creationDate; } ! } --- 12,75 ---- private long key; private Date creationDate = new Date(); ! public float getCapacity() { return capacity; } ! public void setCapacity(float capacity) { this.capacity = capacity; } ! public float getLength() { return length; } ! public void setLength(float length) { this.length = length; } ! public String getName() { return name; } ! public void setName(String name) { this.name = name; } ! public Vertex getSource() { return source; } ! void setSource(Vertex source) { this.source = source; } ! public Vertex getSink() { return sink; } ! void setSink(Vertex sink) { this.sink = sink; } ! public long getKey() { return key; } ! private void setKey(long key) { this.key = key; } ! public Date getCreationDate() { return creationDate; } ! private void setCreationDate(Date creationDate) { this.creationDate = creationDate; } ! } + + + Index: NetworkDemo.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/eg/NetworkDemo.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** NetworkDemo.java 1 Jan 2003 13:54:18 -0000 1.1.1.1 --- NetworkDemo.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 23,28 **** ds = Hibernate.createDatastore() ! .storeClass(Vertex.class) ! .storeClass(Edge.class); // build a SessionFactory --- 23,28 ---- ds = Hibernate.createDatastore() ! .storeClass(Vertex.class) ! .storeClass(Edge.class); // build a SessionFactory *************** *** 31,35 **** // process a stream of commands ! BufferedReader reader = new BufferedReader( new InputStreamReader(System.in) ); boolean quit=false; --- 31,35 ---- // process a stream of commands ! BufferedReader reader = new BufferedReader( new InputStreamReader(System.in) ); boolean quit=false; *************** *** 70,76 **** return false; } ! private static void processCommand(String[] args) throws Exception { ! try { --- 70,76 ---- return false; } ! private static void processCommand(String[] args) throws Exception { ! try { *************** *** 80,84 **** try { ! if ( args[1].equals("vertex") ) { Vertex v = new Vertex(); --- 80,84 ---- try { ! if ( args[1].equals("vertex") ) { Vertex v = new Vertex(); *************** *** 135,139 **** sess.close(); } ! } --- 135,139 ---- sess.close(); } ! } *************** *** 143,147 **** try { ! if ( args[1].equals("edge") ) { for ( int i=2; i<args.length; i++) { --- 143,147 ---- try { ! if ( args[1].equals("edge") ) { for ( int i=2; i<args.length; i++) { *************** *** 158,164 **** } else if ( args[1].equals("vertex") ) { ! for ( int i=2; i<args.length; i++) { ! Vertex v = (Vertex) sess.find( ! "from v in class net.sf.hibernate.eg.Vertex where v.name = ?", args[i], Hibernate.STRING --- 158,164 ---- } else if ( args[1].equals("vertex") ) { ! for ( int i=2; i<args.length; i++) { ! Vertex v = (Vertex) sess.find( ! "from v in class net.sf.hibernate.eg.Vertex where v.name = ?", args[i], Hibernate.STRING *************** *** 171,175 **** System.out.println("usage: delete ( vertex | edge ) <name> [ <name> ] ... "); } ! sess.flush(); sess.connection().commit(); --- 171,175 ---- System.out.println("usage: delete ( vertex | edge ) <name> [ <name> ] ... "); } ! sess.flush(); sess.connection().commit(); *************** *** 191,196 **** try { ! ! if ( args[1].equals("edge") ) { Edge e = (Edge) sess.find( "from e in class net.sf.hibernate.eg.Edge where e.name = ?", --- 191,196 ---- try { ! ! if ( args[1].equals("edge") ) { Edge e = (Edge) sess.find( "from e in class net.sf.hibernate.eg.Edge where e.name = ?", *************** *** 201,207 **** System.out.println("renamed"); } ! else if ( args[1].equals("vertex") ) { ! Vertex v = (Vertex) sess.find( ! "from v in class net.sf.hibernate.eg.Vertex where v.name = ?", args[2], Hibernate.STRING --- 201,207 ---- System.out.println("renamed"); } ! else if ( args[1].equals("vertex") ) { ! Vertex v = (Vertex) sess.find( ! "from v in class net.sf.hibernate.eg.Vertex where v.name = ?", args[2], Hibernate.STRING *************** *** 226,230 **** } } ! else if ( args[0].equals("show") ) { --- 226,230 ---- } } ! else if ( args[0].equals("show") ) { *************** *** 232,248 **** try { ! Iterator iter = sess.find( "from v in class net.sf.hibernate.eg.Vertex" ).iterator(); while ( iter.hasNext() ) { Vertex v = (Vertex) iter.next(); ! System.out.println( ! ( (v instanceof Source) ? "source ":"vertex " ) + ! v.getName() + ! ": " + ! v.getExcessCapacity() + ! " " + ! v.getIncoming().size() + ! "," + ! v.getOutgoing().size() ); } --- 232,248 ---- try { ! Iterator iter = sess.find( "from v in class net.sf.hibernate.eg.Vertex" ).iterator(); while ( iter.hasNext() ) { Vertex v = (Vertex) iter.next(); ! System.out.println( ! ( (v instanceof Source) ? "source ":"vertex " ) + ! v.getName() + ! ": " + ! v.getExcessCapacity() + ! " " + ! v.getIncoming().size() + ! "," + ! v.getOutgoing().size() ); } *************** *** 250,264 **** while ( iter.hasNext() ) { Edge e = (Edge) iter.next(); ! System.out.println( "edge " + ! e.getName() + ! ": " + e.getSource().getName() + ! "->" + ! e.getSink().getName() + ! " " + e.getCapacity() + ! " " + ! e.getLength() ); } --- 250,264 ---- while ( iter.hasNext() ) { Edge e = (Edge) iter.next(); ! System.out.println( "edge " + ! e.getName() + ! ": " + e.getSource().getName() + ! "->" + ! e.getSink().getName() + ! " " + e.getCapacity() + ! " " + ! e.getLength() ); } *************** *** 280,284 **** String query=""; for ( int i=1; i<args.length; i++ ) { ! query=query+args[i]+" "; } --- 280,284 ---- String query=""; for ( int i=1; i<args.length; i++ ) { ! query=query+args[i]+" "; } *************** *** 287,291 **** db.setInitializeLazy(true); try { ! Iterator iter = sess.find(query).iterator(); while ( iter.hasNext() ) { --- 287,291 ---- db.setInitializeLazy(true); try { ! Iterator iter = sess.find(query).iterator(); while ( iter.hasNext() ) { *************** *** 293,299 **** } System.out.println( db.toXML() ); ! sess.connection().commit(); ! } catch (Exception e) { --- 293,299 ---- } System.out.println( db.toXML() ); ! sess.connection().commit(); ! } catch (Exception e) { *************** *** 310,314 **** System.out.println("type \"command help\" for usage description"); } ! } catch (ArrayIndexOutOfBoundsException abe) { --- 310,314 ---- System.out.println("type \"command help\" for usage description"); } ! } catch (ArrayIndexOutOfBoundsException abe) { *************** *** 322,324 **** --- 322,327 ---- } } + + + Index: Source.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/eg/Source.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Source.java 1 Jan 2003 13:54:18 -0000 1.1.1.1 --- Source.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 4,12 **** public class Source extends Vertex { private float strength; ! public float getSourceStrength() { return strength; } ! public void setSourceStrength(float strength) { this.strength = strength; --- 4,12 ---- public class Source extends Vertex { private float strength; ! public float getSourceStrength() { return strength; } ! public void setSourceStrength(float strength) { this.strength = strength; *************** *** 17,19 **** --- 17,22 ---- } } + + + Index: Vertex.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/eg/Vertex.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Vertex.java 1 Jan 2003 13:54:20 -0000 1.1.1.1 --- Vertex.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 10,26 **** private int version; private Date creationDate = new Date(); ! protected Set getIncoming() { return incoming; } ! protected void setIncoming(Set incoming) { this.incoming = incoming; } ! protected Set getOutgoing() { return outgoing; } ! protected void setOutgoing(Set outgoing) { this.outgoing = outgoing; --- 10,26 ---- private int version; private Date creationDate = new Date(); ! protected Set getIncoming() { return incoming; } ! protected void setIncoming(Set incoming) { this.incoming = incoming; } ! protected Set getOutgoing() { return outgoing; } ! protected void setOutgoing(Set outgoing) { this.outgoing = outgoing; *************** *** 50,54 **** return name; } ! public void setName(String name) { this.name = name; --- 50,54 ---- return name; } ! public void setName(String name) { this.name = name; *************** *** 65,94 **** return excess; } ! ! public long getKey() { return key; } ! private void setKey(long key) { this.key = key; } ! public int getVersion() { return version; } ! private void setVersion(int version) { this.version = version; } ! public Date getCreationDate() { return creationDate; } ! private void setCreationDate(Date creationDate) { this.creationDate = creationDate; } ! } --- 65,97 ---- return excess; } ! ! public long getKey() { return key; } ! private void setKey(long key) { this.key = key; } ! public int getVersion() { return version; } ! private void setVersion(int version) { this.version = version; } ! public Date getCreationDate() { return creationDate; } ! private void setCreationDate(Date creationDate) { this.creationDate = creationDate; } ! } + + + |
From: <one...@us...> - 2003-01-04 11:16:00
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/connection Modified Files: C3P0ConnectionProvider.java ConnectionProvider.java ConnectionProviderFactory.java DBCPConnectionProvider.java DatasourceConnectionProvider.java DriverManagerConnectionProvider.java UserSuppliedConnectionProvider.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: C3P0ConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/C3P0ConnectionProvider.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** C3P0ConnectionProvider.java 1 Jan 2003 13:54:09 -0000 1.1.1.1 --- C3P0ConnectionProvider.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 27,33 **** private DataSource ds; private Integer isolation; ! ! private static final Log log = LogFactory.getLog(C3P0ConnectionProvider.class); ! public Connection getConnection() throws SQLException { try { --- 27,33 ---- private DataSource ds; private Integer isolation; ! ! private static final Log log = LogFactory.getLog(C3P0ConnectionProvider.class); ! public Connection getConnection() throws SQLException { try { *************** *** 46,50 **** return true; } ! public void closeConnection(Connection conn) throws SQLException { try { --- 46,50 ---- return true; } ! public void closeConnection(Connection conn) throws SQLException { try { *************** *** 56,68 **** } } ! ! public void configure(Properties props) throws HibernateException { ! String jdbcDriverClass = props.getProperty(Environment.DRIVER); ! String jdbcUrl = props.getProperty(Environment.URL); ! Properties connectionProps = ConnectionProviderFactory.getJdbcConnectionProperties(props); ! ! log.info("C3P0 using driver: " + jdbcDriverClass + " at URL: " + jdbcUrl); ! log.info("Connection properties: " + connectionProps); ! if (jdbcDriverClass==null) { log.warn("No JDBC Driver class was specified by property " + Environment.DRIVER); --- 56,68 ---- } } ! ! public void configure(Properties props) throws HibernateException { ! String jdbcDriverClass = props.getProperty(Environment.DRIVER); ! String jdbcUrl = props.getProperty(Environment.URL); ! Properties connectionProps = ConnectionProviderFactory.getJdbcConnectionProperties(props); ! ! log.info("C3P0 using driver: " + jdbcDriverClass + " at URL: " + jdbcUrl); ! log.info("Connection properties: " + connectionProps); ! if (jdbcDriverClass==null) { log.warn("No JDBC Driver class was specified by property " + Environment.DRIVER); *************** *** 79,84 **** } ! try { ! int minPoolSize = PropertiesHelper.getInt(Environment.C3P0_MIN_SIZE, props, 1); int maxPoolSize = PropertiesHelper.getInt(Environment.C3P0_MAX_SIZE, props, 100); --- 79,84 ---- } ! try { ! int minPoolSize = PropertiesHelper.getInt(Environment.C3P0_MIN_SIZE, props, 1); int maxPoolSize = PropertiesHelper.getInt(Environment.C3P0_MAX_SIZE, props, 100); *************** *** 94,98 **** pcfg.setMaxStatements(maxStatements); pcfg.setTestConnectionOnCheckout(validateConnection); ! /*DataSource unpooled = DataSources.unpooledDataSource( jdbcUrl, props.getProperty(Environment.USER), props.getProperty(Environment.PASS) --- 94,98 ---- pcfg.setMaxStatements(maxStatements); pcfg.setTestConnectionOnCheckout(validateConnection); ! /*DataSource unpooled = DataSources.unpooledDataSource( jdbcUrl, props.getProperty(Environment.USER), props.getProperty(Environment.PASS) *************** *** 100,110 **** DataSource unpooled = DataSources.unpooledDataSource(jdbcUrl, connectionProps); ds = DataSources.pooledDataSource(unpooled, pcfg); ! ! } ! catch (Exception e) { ! log.fatal("could not instantiate C3P0 connection pool", e); ! throw new HibernateException( "Could not instantiate C3P0 connection pool", e ); ! } ! String i = props.getProperty(Environment.ISOLATION); if (i==null) { --- 100,110 ---- DataSource unpooled = DataSources.unpooledDataSource(jdbcUrl, connectionProps); ds = DataSources.pooledDataSource(unpooled, pcfg); ! ! } ! catch (Exception e) { ! log.fatal("could not instantiate C3P0 connection pool", e); ! throw new HibernateException( "Could not instantiate C3P0 connection pool", e ); ! } ! String i = props.getProperty(Environment.ISOLATION); if (i==null) { *************** *** 116,122 **** } ! } ! } ! \ No newline at end of file --- 116,124 ---- } ! } ! } ! ! ! Index: ConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/ConnectionProvider.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ConnectionProvider.java 1 Jan 2003 13:54:09 -0000 1.1.1.1 --- ConnectionProvider.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 7,11 **** /** ! * A strategy for obtaining JDBC connections.Implementors might * also implement connection pooling.<br> * <br> --- 7,11 ---- /** ! * A strategy for obtaining JDBC connections.Implementors might * also implement connection pooling.<br> * <br> *************** *** 15,19 **** * <br> * Implementors should provide a public default constructor. ! * * @see ConnectionProviderFactory */ --- 15,19 ---- * <br> * Implementors should provide a public default constructor. ! * * @see ConnectionProviderFactory */ *************** *** 43,45 **** --- 43,48 ---- public boolean isStatementCache(); } + + + Index: ConnectionProviderFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/ConnectionProviderFactory.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ConnectionProviderFactory.java 1 Jan 2003 13:54:09 -0000 1.1.1.1 --- ConnectionProviderFactory.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 17,21 **** * a <tt>java.util.Properties</tt> instance. The <tt>ConnectionProviderFactory</tt> * first attempts to find a name of a <tt>ConnectionProvider</tt> subclass in the ! * property <tt>hibernate.connection.provider_class</tt>. If missing, heuristics are used * to choose either <tt>DriverManagerConnectionProvider</tt>, * <tt>DatasourceConnectionProvider</tt>, <tt>C3P0ConnectionProvider</tt> or --- 17,21 ---- * a <tt>java.util.Properties</tt> instance. The <tt>ConnectionProviderFactory</tt> * first attempts to find a name of a <tt>ConnectionProvider</tt> subclass in the ! * property <tt>hibernate.connection.provider_class</tt>. If missing, heuristics are used * to choose either <tt>DriverManagerConnectionProvider</tt>, * <tt>DatasourceConnectionProvider</tt>, <tt>C3P0ConnectionProvider</tt> or *************** *** 25,29 **** public final class ConnectionProviderFactory { ! private static final Log log = LogFactory.getLog(ConnectionProviderFactory.class); --- 25,29 ---- public final class ConnectionProviderFactory { ! private static final Log log = LogFactory.getLog(ConnectionProviderFactory.class); *************** *** 36,40 **** return newConnectionProvider( Environment.getProperties() ); } ! /** * Instantiate a <tt>ConnectionProvider</tt> using given properties. --- 36,40 ---- return newConnectionProvider( Environment.getProperties() ); } ! /** * Instantiate a <tt>ConnectionProvider</tt> using given properties. *************** *** 55,59 **** log.fatal("Could not instantiate connection provider", e); throw new HibernateException("Could not instantiate connection provider: " + providerClass); ! } } else if ( properties.getProperty(Environment.DATASOURCE)!=null ) { --- 55,59 ---- log.fatal("Could not instantiate connection provider", e); throw new HibernateException("Could not instantiate connection provider: " + providerClass); ! } } else if ( properties.getProperty(Environment.DATASOURCE)!=null ) { *************** *** 78,82 **** // cannot be instantiated private ConnectionProviderFactory() { throw new UnsupportedOperationException(); } ! /** * Transform JDBC connection properties passed in the form <tt>hibernate.connection.*</tt> to the --- 78,82 ---- // cannot be instantiated private ConnectionProviderFactory() { throw new UnsupportedOperationException(); } ! /** * Transform JDBC connection properties passed in the form <tt>hibernate.connection.*</tt> to the *************** *** 108,111 **** return result; } ! } --- 108,114 ---- return result; } ! } + + + Index: DBCPConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/DBCPConnectionProvider.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DBCPConnectionProvider.java 1 Jan 2003 13:54:10 -0000 1.1.1.1 --- DBCPConnectionProvider.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 24,38 **** /** ! * A connection provider that uses an Apache commons DBCP connection pool. Hibernate will * use this by default if the <tt>hibernate.dbcp.*</tt> properties are set. * @see ConnectionProvider */ public class DBCPConnectionProvider implements ConnectionProvider { ! private DataSource ds; private Integer isolation; ! ! private static final Log log = LogFactory.getLog(DBCPConnectionProvider.class); ! public Connection getConnection() throws SQLException { try { --- 24,38 ---- /** ! * A connection provider that uses an Apache commons DBCP connection pool. Hibernate will * use this by default if the <tt>hibernate.dbcp.*</tt> properties are set. * @see ConnectionProvider */ public class DBCPConnectionProvider implements ConnectionProvider { ! private DataSource ds; private Integer isolation; ! ! private static final Log log = LogFactory.getLog(DBCPConnectionProvider.class); ! public Connection getConnection() throws SQLException { try { *************** *** 51,55 **** return true; } ! public void closeConnection(Connection conn) throws SQLException { try { --- 51,55 ---- return true; } ! public void closeConnection(Connection conn) throws SQLException { try { *************** *** 61,73 **** } } ! ! public void configure(Properties props) throws HibernateException { ! String jdbcDriverClass = props.getProperty(Environment.DRIVER); ! String jdbcUrl = props.getProperty(Environment.URL); ! Properties connectionProps = ConnectionProviderFactory.getJdbcConnectionProperties(props); ! ! log.info("DBCP using driver: " + jdbcDriverClass + " at URL: " + jdbcUrl); ! log.info("Connection properties: " + connectionProps); ! if (jdbcDriverClass==null) { log.warn("No JDBC Driver class was specified by property " + Environment.DRIVER); --- 61,73 ---- } } ! ! public void configure(Properties props) throws HibernateException { ! String jdbcDriverClass = props.getProperty(Environment.DRIVER); ! String jdbcUrl = props.getProperty(Environment.URL); ! Properties connectionProps = ConnectionProviderFactory.getJdbcConnectionProperties(props); ! ! log.info("DBCP using driver: " + jdbcDriverClass + " at URL: " + jdbcUrl); ! log.info("Connection properties: " + connectionProps); ! if (jdbcDriverClass==null) { log.warn("No JDBC Driver class was specified by property " + Environment.DRIVER); *************** *** 84,131 **** } ! try { ! ! // We'll need a ObjectPool that serves as the ! // actual pool of connections. ! ObjectPool connectionPool = new GenericObjectPool( ! null, ! Integer.parseInt( props.getProperty(Environment.DBCP_MAXACTIVE) ), ! Byte.parseByte( props.getProperty(Environment.DBCP_WHENEXHAUSTED) ), ! Long.parseLong( props.getProperty(Environment.DBCP_MAXWAIT) ), ! Integer.parseInt( props.getProperty(Environment.DBCP_MAXIDLE) ) ! ); ! ! // We'll need a KeyedObjectPoolFactory that serves as the ! // actual pool of prepared statements. ! KeyedObjectPoolFactory statementPool = new GenericKeyedObjectPoolFactory( ! null, ! Integer.parseInt( props.getProperty(Environment.DBCP_PS_MAXACTIVE) ), ! Byte.parseByte( props.getProperty(Environment.DBCP_PS_WHENEXHAUSTED) ), ! Long.parseLong( props.getProperty(Environment.DBCP_PS_MAXWAIT) ), ! Integer.parseInt( props.getProperty(Environment.DBCP_PS_MAXIDLE) ) ); ! ! // Next, we'll create a ConnectionFactory that the ! // pool will use to create Connections. ! // We'll use the DriverManagerConnectionFactory. ! ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(jdbcUrl, connectionProps); ! ! // Now we'll create the PoolableConnectionFactory, which wraps ! // the "real" Connections created by the ConnectionFactory with ! // the classes that implement the pooling functionality. ! String validationQuery = props.getProperty(Environment.DBCP_VALIDATION_QUERY); ! new PoolableConnectionFactory(connectionFactory, connectionPool, statementPool, validationQuery, false, false); ! ! // Finally, we create the PoolingDriver itself, ! // passing in the object pool we created. ! ds = new PoolingDataSource(connectionPool); ! ! ! } ! catch (Exception e) { ! log.fatal("could not instantiate DBCP connection pool", e); ! throw new HibernateException( "Could not instantiate DBCP connection pool", e ); ! } ! String i = props.getProperty(Environment.ISOLATION); if (i==null) { --- 84,131 ---- } ! try { ! ! // We'll need a ObjectPool that serves as the ! // actual pool of connections. ! ObjectPool connectionPool = new GenericObjectPool( ! null, ! Integer.parseInt( props.getProperty(Environment.DBCP_MAXACTIVE) ), ! Byte.parseByte( props.getProperty(Environment.DBCP_WHENEXHAUSTED) ), ! Long.parseLong( props.getProperty(Environment.DBCP_MAXWAIT) ), ! Integer.parseInt( props.getProperty(Environment.DBCP_MAXIDLE) ) ); ! ! // We'll need a KeyedObjectPoolFactory that serves as the ! // actual pool of prepared statements. ! KeyedObjectPoolFactory statementPool = new GenericKeyedObjectPoolFactory( ! null, ! Integer.parseInt( props.getProperty(Environment.DBCP_PS_MAXACTIVE) ), ! Byte.parseByte( props.getProperty(Environment.DBCP_PS_WHENEXHAUSTED) ), ! Long.parseLong( props.getProperty(Environment.DBCP_PS_MAXWAIT) ), ! Integer.parseInt( props.getProperty(Environment.DBCP_PS_MAXIDLE) ) ! ); ! ! // Next, we'll create a ConnectionFactory that the ! // pool will use to create Connections. ! // We'll use the DriverManagerConnectionFactory. ! ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(jdbcUrl, connectionProps); ! ! // Now we'll create the PoolableConnectionFactory, which wraps ! // the "real" Connections created by the ConnectionFactory with ! // the classes that implement the pooling functionality. ! String validationQuery = props.getProperty(Environment.DBCP_VALIDATION_QUERY); ! new PoolableConnectionFactory(connectionFactory, connectionPool, statementPool, validationQuery, false, false); ! ! // Finally, we create the PoolingDriver itself, ! // passing in the object pool we created. ! ds = new PoolingDataSource(connectionPool); ! ! ! } ! catch (Exception e) { ! log.fatal("could not instantiate DBCP connection pool", e); ! throw new HibernateException( "Could not instantiate DBCP connection pool", e ); ! } ! String i = props.getProperty(Environment.ISOLATION); if (i==null) { *************** *** 137,143 **** } ! } ! } ! \ No newline at end of file --- 137,145 ---- } ! } ! } ! ! ! Index: DatasourceConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/DatasourceConnectionProvider.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DatasourceConnectionProvider.java 1 Jan 2003 13:54:10 -0000 1.1.1.1 --- DatasourceConnectionProvider.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 20,53 **** */ public class DatasourceConnectionProvider implements ConnectionProvider { ! private DataSource ds; ! private String user; ! private String pass; ! ! private static final Log log = LogFactory.getLog(DatasourceConnectionProvider.class); ! ! public void configure(Properties props) throws HibernateException { ! ! String jndi_name = props.getProperty(Environment.DATASOURCE); ! if (jndi_name==null) { ! String msg = "datasource JNDI name was not specified by property " + Environment.DATASOURCE; ! log.fatal(msg); ! throw new HibernateException(msg); ! } ! ! user = props.getProperty(Environment.USER); ! pass = props.getProperty(Environment.PASS); ! try { ! ds = (DataSource) NamingHelper.getInitialContext(props).lookup(jndi_name); ! } ! catch (Exception e) { ! log.fatal( "Could not find datasource: " + jndi_name, e ); ! throw new HibernateException( "Could not find datasource", e ); ! } ! log.info( "Using datasource: " + jndi_name ); ! } ! ! public Connection getConnection() throws SQLException { ! try { if (user != null || pass != null) { return ds.getConnection(user, pass); --- 20,53 ---- */ public class DatasourceConnectionProvider implements ConnectionProvider { ! private DataSource ds; ! private String user; ! private String pass; ! ! private static final Log log = LogFactory.getLog(DatasourceConnectionProvider.class); ! ! public void configure(Properties props) throws HibernateException { ! String jndi_name = props.getProperty(Environment.DATASOURCE); ! if (jndi_name==null) { ! String msg = "datasource JNDI name was not specified by property " + Environment.DATASOURCE; ! log.fatal(msg); ! throw new HibernateException(msg); ! } ! ! user = props.getProperty(Environment.USER); ! pass = props.getProperty(Environment.PASS); ! ! try { ! ds = (DataSource) NamingHelper.getInitialContext(props).lookup(jndi_name); ! } ! catch (Exception e) { ! log.fatal( "Could not find datasource: " + jndi_name, e ); ! throw new HibernateException( "Could not find datasource", e ); ! } ! log.info( "Using datasource: " + jndi_name ); ! } ! ! public Connection getConnection() throws SQLException { ! try { if (user != null || pass != null) { return ds.getConnection(user, pass); *************** *** 56,80 **** return ds.getConnection(); } ! } ! catch (SQLException sqle) { ! JDBCExceptionReporter.logExceptions(sqle); ! throw sqle; ! } ! } ! ! public void closeConnection(Connection conn) throws SQLException { ! try { ! conn.close(); ! } ! catch (SQLException sqle) { ! JDBCExceptionReporter.logExceptions(sqle); ! throw sqle; ! } ! } ! public boolean isStatementCache() { return true; } ! } --- 56,83 ---- return ds.getConnection(); } ! } ! catch (SQLException sqle) { ! JDBCExceptionReporter.logExceptions(sqle); ! throw sqle; ! } ! } ! ! public void closeConnection(Connection conn) throws SQLException { ! try { ! conn.close(); ! } ! catch (SQLException sqle) { ! JDBCExceptionReporter.logExceptions(sqle); ! throw sqle; ! } ! } ! public boolean isStatementCache() { return true; } ! } + + + Index: DriverManagerConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/DriverManagerConnectionProvider.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DriverManagerConnectionProvider.java 3 Jan 2003 22:47:24 -0000 1.2 --- DriverManagerConnectionProvider.java 4 Jan 2003 11:15:27 -0000 1.3 *************** *** 36,47 **** String driverClass = props.getProperty(Environment.DRIVER); ! poolSize = PropertiesHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20 log.info("Hibernate connection pool size: " + poolSize); isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props); ! if (isolation!=null) ! log.info( "JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) ); ! if (driverClass==null) { log.warn("no JDBC Driver class was specified by property " + Environment.DRIVER); --- 36,47 ---- String driverClass = props.getProperty(Environment.DRIVER); ! poolSize = PropertiesHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20 log.info("Hibernate connection pool size: " + poolSize); isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props); ! if (isolation!=null) ! log.info( "JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) ); ! if (driverClass==null) { log.warn("no JDBC Driver class was specified by property " + Environment.DRIVER); *************** *** 59,70 **** url = props.getProperty(Environment.URL); ! if (url==null) { ! String msg = "JDBC URL was not specified by property " + Environment.URL; ! log.fatal(msg); ! throw new HibernateException(msg); ! } ! connectionProps = ConnectionProviderFactory.getJdbcConnectionProperties(props); ! log.info( "using driver: " + driverClass + " at URL: " + url ); log.info("connection properties: " + connectionProps); --- 59,70 ---- url = props.getProperty(Environment.URL); ! if (url==null) { ! String msg = "JDBC URL was not specified by property " + Environment.URL; ! log.fatal(msg); ! throw new HibernateException(msg); ! } ! connectionProps = ConnectionProviderFactory.getJdbcConnectionProperties(props); ! log.info( "using driver: " + driverClass + " at URL: " + url ); log.info("connection properties: " + connectionProps); *************** *** 128,132 **** JDBCExceptionReporter.logExceptions(sqle); throw sqle; ! } } --- 128,132 ---- JDBCExceptionReporter.logExceptions(sqle); throw sqle; ! } } *************** *** 149,153 **** } } ! } --- 149,156 ---- } } ! } + + + Index: UserSuppliedConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/UserSuppliedConnectionProvider.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** UserSuppliedConnectionProvider.java 1 Jan 2003 13:54:12 -0000 1.1.1.1 --- UserSuppliedConnectionProvider.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 17,21 **** */ public class UserSuppliedConnectionProvider implements ConnectionProvider { ! /** * @see net.sf.hibernate.connection.ConnectionProvider#configure(Properties) --- 17,21 ---- */ public class UserSuppliedConnectionProvider implements ConnectionProvider { ! /** * @see net.sf.hibernate.connection.ConnectionProvider#configure(Properties) *************** *** 24,28 **** LogFactory.getLog(UserSuppliedConnectionProvider.class).warn("No connection properties specified - the user must supply JDBC connections"); } ! /** * @see net.sf.hibernate.connection.ConnectionProvider#getConnection() --- 24,28 ---- LogFactory.getLog(UserSuppliedConnectionProvider.class).warn("No connection properties specified - the user must supply JDBC connections"); } ! /** * @see net.sf.hibernate.connection.ConnectionProvider#getConnection() *************** *** 31,35 **** throw new UnsupportedOperationException("The user must supply a JDBC connection"); } ! /** * @see net.sf.hibernate.connection.ConnectionProvider#closeConnection(Connection) --- 31,35 ---- throw new UnsupportedOperationException("The user must supply a JDBC connection"); } ! /** * @see net.sf.hibernate.connection.ConnectionProvider#closeConnection(Connection) *************** *** 38,42 **** throw new UnsupportedOperationException("The user must supply a JDBC connection"); } ! /** * @see net.sf.hibernate.connection.ConnectionProvider#isStatementCache() --- 38,42 ---- throw new UnsupportedOperationException("The user must supply a JDBC connection"); } ! /** * @see net.sf.hibernate.connection.ConnectionProvider#isStatementCache() *************** *** 45,48 **** return false; } ! } --- 45,51 ---- return false; } ! } + + + |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate Modified Files: AssertionFailure.java CallbackException.java Databinder.java Environment.java FlushMode.java Hibernate.java HibernateException.java InstantiationException.java Interceptor.java LazyInitializationException.java Lifecycle.java LockMode.java MappingException.java ObjectDeletedException.java ObjectNotFoundException.java PersistentEnum.java PersistentObjectException.java PropertyAccessException.java PropertyNotFoundException.java Query.java QueryException.java ScrollableResults.java Session.java SessionFactory.java StaleObjectStateException.java Transaction.java TransactionException.java TransientObjectException.java UserType.java Validatable.java ValidationFailure.java WrongClassException.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: AssertionFailure.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/AssertionFailure.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** AssertionFailure.java 1 Jan 2003 13:53:40 -0000 1.1.1.1 --- AssertionFailure.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 13,26 **** private static final Log log = LogFactory.getLog(AssertionFailure.class); ! public AssertionFailure(String s) { super(s); log.error("An AssertionFailure occured - this may indicate a bug in Hibernate", this); } ! public AssertionFailure(String s, Throwable t) { super(s, t); log.error("An AssertionFailure occured - this may indicate a bug in Hibernate", t); } ! } --- 13,29 ---- private static final Log log = LogFactory.getLog(AssertionFailure.class); ! public AssertionFailure(String s) { super(s); log.error("An AssertionFailure occured - this may indicate a bug in Hibernate", this); } ! public AssertionFailure(String s, Throwable t) { super(s, t); log.error("An AssertionFailure occured - this may indicate a bug in Hibernate", t); } ! } + + + Index: CallbackException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/CallbackException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CallbackException.java 1 Jan 2003 13:53:40 -0000 1.1.1.1 --- CallbackException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 17,24 **** super(message); } ! public CallbackException(String message, Exception e) { super(message, e); } ! } --- 17,27 ---- super(message); } ! public CallbackException(String message, Exception e) { super(message, e); } ! } + + + Index: Databinder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Databinder.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Databinder.java 1 Jan 2003 13:53:40 -0000 1.1.1.1 --- Databinder.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 7,17 **** /** ! * Provides XML Marshalling for classes registered with a <tt>Datastore</tt>. ! * Hibernate defines a <i>generic</i> XML format that may be used to ! * represent any class (<tt>hibernate-generic.dtd</tt>). The user configures ! * an XSLT stylesheet for marshalling data from this generic format to an * application and / or user readable format. By default, Hibernate will * use <tt>hibernate-default.xslt</tt> which maps data to a useful human - ! * readable format.<br> * <br> * The property <tt>hibernate.xml.output_stylesheet</tt> --- 7,17 ---- /** ! * Provides XML Marshalling for classes registered with a <tt>Datastore</tt>. ! * Hibernate defines a <i>generic</i> XML format that may be used to ! * represent any class (<tt>hibernate-generic.dtd</tt>). The user configures ! * an XSLT stylesheet for marshalling data from this generic format to an * application and / or user readable format. By default, Hibernate will * use <tt>hibernate-default.xslt</tt> which maps data to a useful human - ! * readable format.<br> * <br> * The property <tt>hibernate.xml.output_stylesheet</tt> *************** *** 43,64 **** /** * Output the generic XML representation of the bound objects ! * * @return String generic XML representation * @throws HibernateException */ public String toGenericXML() throws HibernateException; ! /** * Output the generic XML representation of the bound objects * as a DOM tree ! * * @return Node generic XML tree * @throws HibernateException */ public Document toGenericDOM() throws HibernateException; ! /** * Output the custom XML representation of the bound objects ! * * @return String custom XML representation * @throws HibernateException --- 43,64 ---- /** * Output the generic XML representation of the bound objects ! * * @return String generic XML representation * @throws HibernateException */ public String toGenericXML() throws HibernateException; ! /** * Output the generic XML representation of the bound objects * as a DOM tree ! * * @return Node generic XML tree * @throws HibernateException */ public Document toGenericDOM() throws HibernateException; ! /** * Output the custom XML representation of the bound objects ! * * @return String custom XML representation * @throws HibernateException *************** *** 66,74 **** */ public String toXML() throws HibernateException, TransformerException; ! /** * Output the custom XML representation of the bound objects as * a DOM tree ! * * @return Node custom XML tree * @throws HibernateException --- 66,74 ---- */ public String toXML() throws HibernateException, TransformerException; ! /** * Output the custom XML representation of the bound objects as * a DOM tree ! * * @return Node custom XML tree * @throws HibernateException *************** *** 80,84 **** * Controls whether bound objects (and their associated objects) that are lazily initialized are * explicitly initialized or left as they are. ! * * @param initializeLazy true to explicitly initialize lazy objects, false to leave them in * the state they are in. --- 80,84 ---- * Controls whether bound objects (and their associated objects) that are lazily initialized are * explicitly initialized or left as they are. ! * * @param initializeLazy true to explicitly initialize lazy objects, false to leave them in * the state they are in. *************** *** 86,87 **** --- 86,90 ---- public void setInitializeLazy(boolean initializeLazy); } + + + Index: Environment.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Environment.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Environment.java 1 Jan 2003 13:53:42 -0000 1.1.1.1 --- Environment.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 38,44 **** public final class Environment { ! private static final String VERSION = "2.0 beta 1"; ! /** * <tt>ConnectionProvider</tt> implementor to use when obtaining connections --- 38,44 ---- public final class Environment { ! private static final String VERSION = "2.0 beta 1"; ! /** * <tt>ConnectionProvider</tt> implementor to use when obtaining connections *************** *** 77,86 **** */ public static final String CONNECTION_PREFIX = "hibernate.connection"; ! /** * Maximum size for Hibernate's statement cache */ public static final String STATEMENT_CACHE_SIZE ="hibernate.statement_cache.size"; ! /** * JNDI initial context class, <tt>Context.INITIAL_CONTEXT_FACTORY</tt> --- 77,86 ---- */ public static final String CONNECTION_PREFIX = "hibernate.connection"; ! /** * Maximum size for Hibernate's statement cache */ public static final String STATEMENT_CACHE_SIZE ="hibernate.statement_cache.size"; ! /** * JNDI initial context class, <tt>Context.INITIAL_CONTEXT_FACTORY</tt> *************** *** 99,103 **** */ public static final String SESSION_FACTORY_NAME = "hibernate.session_factory_name"; ! /** * Hibernate SQL <tt>Dialect</tt> class --- 99,103 ---- */ public static final String SESSION_FACTORY_NAME = "hibernate.session_factory_name"; ! /** * Hibernate SQL <tt>Dialect</tt> class *************** *** 108,112 **** */ public static final String DEFAULT_SCHEMA = "hibernate.default_schema"; ! /** * Enable logging of generated SQL to the console --- 108,112 ---- */ public static final String DEFAULT_SCHEMA = "hibernate.default_schema"; ! /** * Enable logging of generated SQL to the console *************** *** 126,144 **** */ public static final String USE_SCROLLABLE_RESULTSET = "hibernate.jdbc.use_scrollable_resultset"; ! /** ! * Gives the JDBC driver a hint as to the number of rows that should be fetched from the database ! * when more rows are needed. If <tt>0</tt>, JDBC driver default settings will be used. ! */ ! public static final String STATEMENT_FETCH_SIZE = "hibernate.jdbc.fetch_size"; /** * Maximum JDBC batch size. A nonzero value enables batch updates. */ public static final String STATEMENT_BATCH_SIZE = "hibernate.jdbc.batch_size"; ! /** * An XSLT resource used to generate "custom" XML */ public static final String OUTPUT_STYLESHEET ="hibernate.xml.output_stylesheet"; ! /** * Maximum size of C3P0 connection pool --- 126,144 ---- */ public static final String USE_SCROLLABLE_RESULTSET = "hibernate.jdbc.use_scrollable_resultset"; ! /** ! * Gives the JDBC driver a hint as to the number of rows that should be fetched from the database ! * when more rows are needed. If <tt>0</tt>, JDBC driver default settings will be used. ! */ ! public static final String STATEMENT_FETCH_SIZE = "hibernate.jdbc.fetch_size"; /** * Maximum JDBC batch size. A nonzero value enables batch updates. */ public static final String STATEMENT_BATCH_SIZE = "hibernate.jdbc.batch_size"; ! /** * An XSLT resource used to generate "custom" XML */ public static final String OUTPUT_STYLESHEET ="hibernate.xml.output_stylesheet"; ! /** * Maximum size of C3P0 connection pool *************** *** 161,165 **** */ public static final String C3P0_VALIDATE_CONNECTION = "hibernate.c3p0.validate"; ! /** * Maximum number of checked out connections for DBCP connection pool --- 161,165 ---- */ public static final String C3P0_VALIDATE_CONNECTION = "hibernate.c3p0.validate"; ! /** * Maximum number of checked out connections for DBCP connection pool *************** *** 198,202 **** */ public static final String DBCP_PS_WHENEXHAUSTED = "hibernate.dbcp.ps.whenExhaustedAction"; ! /** * <tt>TransactionFactory</tt> implementor to use for creating <tt>Transaction</tt>s --- 198,202 ---- */ public static final String DBCP_PS_WHENEXHAUSTED = "hibernate.dbcp.ps.whenExhaustedAction"; ! /** * <tt>TransactionFactory</tt> implementor to use for creating <tt>Transaction</tt>s *************** *** 211,215 **** */ public static final String USER_TRANSACTION = "jta.UserTransaction"; ! /** * A comma-seperated list of token substitutions to use when translating a Hibernate --- 211,215 ---- */ public static final String USER_TRANSACTION = "jta.UserTransaction"; ! /** * A comma-seperated list of token substitutions to use when translating a Hibernate *************** *** 221,227 **** */ public static final String QUERY_IMPORTS = "hibernate.query.imports"; ! //Obsolete properties: ! private static final String OUTPUT_STYLESHEET_OLD ="hibernate.output_stylesheet"; private static final String CONNECTION_PROVIDER_OLD ="hibernate.connection_provider"; --- 221,227 ---- */ public static final String QUERY_IMPORTS = "hibernate.query.imports"; ! //Obsolete properties: ! private static final String OUTPUT_STYLESHEET_OLD ="hibernate.output_stylesheet"; private static final String CONNECTION_PROVIDER_OLD ="hibernate.connection_provider"; *************** *** 236,240 **** private static final String URL_OLD ="hibernate.url"; private static final String USE_STREAMS_FOR_BINARY_OLD = "hibernate.use_streams_for_binary"; ! private static final String STATEMENT_FETCH_SIZE_OLD = "hibernate.statement.fetch_size"; private static final String USE_SCROLLABLE_RESULTSET_OLD = "hibernate.use_scrollable_resultset"; /** --- 236,240 ---- private static final String URL_OLD ="hibernate.url"; private static final String USE_STREAMS_FOR_BINARY_OLD = "hibernate.use_streams_for_binary"; ! private static final String STATEMENT_FETCH_SIZE_OLD = "hibernate.statement.fetch_size"; private static final String USE_SCROLLABLE_RESULTSET_OLD = "hibernate.use_scrollable_resultset"; /** *************** *** 243,257 **** */ public static final String USE_JDBC_BATCH = "hibernate.use_jdbc_batch"; ! private static final boolean jvmSupportsProxies; private static final boolean useStreamsForBinary; private static final boolean jvmSupportsLinkedHashCollections; ! private static final Properties properties; private static final HashMap isolationLevels = new HashMap(); private static final Map obsoleteProperties = new HashMap(); ! private static final Log log = LogFactory.getLog(Environment.class); ! /** * Issues warnings to the user when any obsolete property names are used. --- 243,257 ---- */ public static final String USE_JDBC_BATCH = "hibernate.use_jdbc_batch"; ! private static final boolean jvmSupportsProxies; private static final boolean useStreamsForBinary; private static final boolean jvmSupportsLinkedHashCollections; ! private static final Properties properties; private static final HashMap isolationLevels = new HashMap(); private static final Map obsoleteProperties = new HashMap(); ! private static final Log log = LogFactory.getLog(Environment.class); ! /** * Issues warnings to the user when any obsolete property names are used. *************** *** 265,273 **** } } ! static { ! log.info("Hibernate " + VERSION); ! isolationLevels.put( new Integer(Connection.TRANSACTION_NONE), "NONE" ); isolationLevels.put( new Integer(Connection.TRANSACTION_READ_UNCOMMITTED), "READ_UNCOMMITTED" ); --- 265,273 ---- } } ! static { ! log.info("Hibernate " + VERSION); ! isolationLevels.put( new Integer(Connection.TRANSACTION_NONE), "NONE" ); isolationLevels.put( new Integer(Connection.TRANSACTION_READ_UNCOMMITTED), "READ_UNCOMMITTED" ); *************** *** 275,279 **** isolationLevels.put( new Integer(Connection.TRANSACTION_REPEATABLE_READ), "REPEATABLE_READ" ); isolationLevels.put( new Integer(Connection.TRANSACTION_SERIALIZABLE), "SERIALIZABLE" ); ! obsoleteProperties.put(CONNECTION_PROVIDER_OLD, CONNECTION_PROVIDER); obsoleteProperties.put(DRIVER_OLD, DRIVER); --- 275,279 ---- isolationLevels.put( new Integer(Connection.TRANSACTION_REPEATABLE_READ), "REPEATABLE_READ" ); isolationLevels.put( new Integer(Connection.TRANSACTION_SERIALIZABLE), "SERIALIZABLE" ); ! obsoleteProperties.put(CONNECTION_PROVIDER_OLD, CONNECTION_PROVIDER); obsoleteProperties.put(DRIVER_OLD, DRIVER); *************** *** 291,297 **** obsoleteProperties.put(USE_STREAMS_FOR_BINARY_OLD, USE_STREAMS_FOR_BINARY); obsoleteProperties.put(STATEMENT_FETCH_SIZE_OLD, STATEMENT_FETCH_SIZE); ! properties = new Properties(); ! InputStream stream = Environment.class.getResourceAsStream("/hibernate.properties"); if ( stream==null ) { --- 291,297 ---- obsoleteProperties.put(USE_STREAMS_FOR_BINARY_OLD, USE_STREAMS_FOR_BINARY); obsoleteProperties.put(STATEMENT_FETCH_SIZE_OLD, STATEMENT_FETCH_SIZE); ! properties = new Properties(); ! InputStream stream = Environment.class.getResourceAsStream("/hibernate.properties"); if ( stream==null ) { *************** *** 307,319 **** } } ! properties.putAll( System.getProperties() ); ! verifyProperties(properties); ! useStreamsForBinary = PropertiesHelper.getBoolean(USE_STREAMS_FOR_BINARY, properties); ! if (useStreamsForBinary) log.info("using java.io streams to persist binary types"); ! boolean proxySupport; try { --- 307,319 ---- } } ! properties.putAll( System.getProperties() ); ! verifyProperties(properties); ! useStreamsForBinary = PropertiesHelper.getBoolean(USE_STREAMS_FOR_BINARY, properties); ! if (useStreamsForBinary) log.info("using java.io streams to persist binary types"); ! boolean proxySupport; try { *************** *** 326,330 **** log.info("JVM proxy support: " + proxySupport); jvmSupportsProxies = proxySupport; ! boolean linkedHashSupport; try { --- 326,330 ---- log.info("JVM proxy support: " + proxySupport); jvmSupportsProxies = proxySupport; ! boolean linkedHashSupport; try { *************** *** 336,369 **** } jvmSupportsLinkedHashCollections = linkedHashSupport; ! } ! ! /** ! * Does this JVM support dynamic proxies? (Now return true because CGLIB ! * proxies work on all supported JDK) ! */ ! public static boolean jvmSupportsProxies() { ! return true;//jvmSupportsProxies; ! } ! ! /** ! * Does this JVM support <tt>LinkedHashSet</tt>, <tt>LinkedHashMap</tt>? ! * @see java.util.LinkedHashSet ! * @see java.util.LinkedHashMap ! */ ! public static boolean jvmSupportsLinkedHashCollections() { ! return jvmSupportsLinkedHashCollections; ! } ! ! /** ! * Should we use streams to bind binary types to JDBC IN parameters? ! * Property <tt>hibernate.jdbc.use_streams_for_binary</tt>. ! */ public static boolean useStreamsForBinary() { ! return useStreamsForBinary; ! } ! ! private Environment() { throw new UnsupportedOperationException(); } ! /** * Return <tt>System</tt> properties, extended by any properties specified --- 336,369 ---- } jvmSupportsLinkedHashCollections = linkedHashSupport; ! } ! ! /** ! * Does this JVM support dynamic proxies? (Now return true because CGLIB ! * proxies work on all supported JDK) ! */ ! public static boolean jvmSupportsProxies() { ! return true;//jvmSupportsProxies; ! } ! ! /** ! * Does this JVM support <tt>LinkedHashSet</tt>, <tt>LinkedHashMap</tt>? ! * @see java.util.LinkedHashSet ! * @see java.util.LinkedHashMap ! */ ! public static boolean jvmSupportsLinkedHashCollections() { ! return jvmSupportsLinkedHashCollections; ! } ! ! /** ! * Should we use streams to bind binary types to JDBC IN parameters? ! * Property <tt>hibernate.jdbc.use_streams_for_binary</tt>. ! */ public static boolean useStreamsForBinary() { ! return useStreamsForBinary; ! } ! ! private Environment() { throw new UnsupportedOperationException(); } ! /** * Return <tt>System</tt> properties, extended by any properties specified *************** *** 371,378 **** * @return Properties */ ! public static Properties getProperties() { ! return properties; ! } ! /** * Get the name of a JDBC transaction isolation level --- 371,378 ---- * @return Properties */ ! public static Properties getProperties() { ! return properties; ! } ! /** * Get the name of a JDBC transaction isolation level *************** *** 382,389 **** * @return String */ ! public static String isolationLevelToString(int isolation) { ! return (String) isolationLevels.get( new Integer(isolation) ); ! } ! } --- 382,392 ---- * @return String */ ! public static String isolationLevelToString(int isolation) { ! return (String) isolationLevels.get( new Integer(isolation) ); ! } ! } + + + Index: FlushMode.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/FlushMode.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** FlushMode.java 1 Jan 2003 13:53:42 -0000 1.1.1.1 --- FlushMode.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 8,14 **** /** * Represents a flushing strategy. The flush process synchronizes ! * database state with session state by detecting state changes * and executing SQL statements. ! * * @see Session#setFlushMode(FlushMode) */ --- 8,14 ---- /** * Represents a flushing strategy. The flush process synchronizes ! * database state with session state by detecting state changes * and executing SQL statements. ! * * @see Session#setFlushMode(FlushMode) */ *************** *** 27,31 **** /** * The <tt>Session</tt> is never flushed unless <tt>flush()</tt> ! * is explicitly called by the application. This mode is very * efficient for read only transactions. */ --- 27,31 ---- /** * The <tt>Session</tt> is never flushed unless <tt>flush()</tt> ! * is explicitly called by the application. This mode is very * efficient for read only transactions. */ *************** *** 42,46 **** */ public static final FlushMode AUTO = new FlushMode(10, "AUTO"); ! static { instances.put( new Integer(NEVER.level), NEVER ); --- 42,46 ---- */ public static final FlushMode AUTO = new FlushMode(10, "AUTO"); ! static { instances.put( new Integer(NEVER.level), NEVER ); *************** *** 52,55 **** return instances.get( new Integer(level) ); } ! } --- 52,58 ---- return instances.get( new Integer(level) ); } ! } + + + Index: Hibernate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Hibernate.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Hibernate.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- Hibernate.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 92,103 **** */ public static final NullableType BINARY = new BinaryType(); ! /** ! * Hibernate <tt>blob</tt> type ! */ ! public static final NullableType BLOB = new BlobType(); ! /** ! * Hibernate <tt>clob</tt> type ! */ ! public static final NullableType CLOB = new ClobType(); /** * Hibernate <tt>calendar</tt> type --- 92,103 ---- */ public static final NullableType BINARY = new BinaryType(); ! /** ! * Hibernate <tt>blob</tt> type ! */ ! public static final NullableType BLOB = new BlobType(); ! /** ! * Hibernate <tt>clob</tt> type ! */ ! public static final NullableType CLOB = new ClobType(); /** * Hibernate <tt>calendar</tt> type *************** *** 132,137 **** */ public static final NullableType SERIALIZABLE = new SerializableType(Serializable.class); ! ! /** * Cannot be instantiated. --- 132,137 ---- */ public static final NullableType SERIALIZABLE = new SerializableType(Serializable.class); ! ! /** * Cannot be instantiated. *************** *** 174,180 **** return new DatastoreImpl(); } ! private static boolean configured; ! /** * Configure <tt>SessionFactory</tt>(s) from resource <tt>/hibernate.cfg.xml</tt>. The application --- 174,180 ---- return new DatastoreImpl(); } ! private static boolean configured; ! /** * Configure <tt>SessionFactory</tt>(s) from resource <tt>/hibernate.cfg.xml</tt>. The application *************** *** 185,190 **** */ public static void configure() throws HibernateException { ! ! synchronized (Hibernate.class) { if (!configured) { --- 185,190 ---- */ public static void configure() throws HibernateException { ! ! synchronized (Hibernate.class) { if (!configured) { *************** *** 230,233 **** public static Clob createClob(String string) { return new ClobImpl(string); ! } } --- 230,236 ---- public static Clob createClob(String string) { return new ClobImpl(string); ! } } + + + Index: HibernateException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/HibernateException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HibernateException.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- HibernateException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 13,22 **** public HibernateException(Throwable root) { ! super(root); } ! public HibernateException(String string, Throwable root) { ! super(string, root); } --- 13,22 ---- public HibernateException(Throwable root) { ! super(root); } ! public HibernateException(String string, Throwable root) { ! super(string, root); } *************** *** 25,26 **** --- 25,29 ---- } } + + + Index: InstantiationException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/InstantiationException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** InstantiationException.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- InstantiationException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 10,26 **** private final Class clazz; ! public InstantiationException(String s, Class clazz, Throwable root) { super(s, root); this.clazz = clazz; } ! public Class getPersistentClass() { return clazz; } ! public String getMessage() { return super.getMessage() + clazz.getName(); } ! } --- 10,29 ---- private final Class clazz; ! public InstantiationException(String s, Class clazz, Throwable root) { super(s, root); this.clazz = clazz; } ! public Class getPersistentClass() { return clazz; } ! public String getMessage() { return super.getMessage() + clazz.getName(); } ! } + + + Index: Interceptor.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Interceptor.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Interceptor.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- Interceptor.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 8,22 **** /** ! * Allows user code to inspect and / or change property values before they are written and after they are read * from the database.<br> * <br> ! * There might be a single instance of <tt>Interceptor</tt> for a <tt>SessionFactory</tt>, or a new instance ! * might be specified for each <tt>Session</tt>. Whichever approach is used, the interceptor must be ! * serializable if the <tt>Session</tt> is to be serializable. This means that <tt>SessionFactory</tt>-scoped * interceptors should implement <tt>readResolve()</tt>.<br> * <br> ! * The <tt>Session</tt> may not be invoked from a callback (nor may a callback cause a collection or proxy to * be lazily initialized).<br> ! * * @see SessionFactory#openSession(Interceptor) * @see Datastore#buildSessionFactory(Interceptor) --- 8,22 ---- /** ! * Allows user code to inspect and / or change property values before they are written and after they are read * from the database.<br> * <br> ! * There might be a single instance of <tt>Interceptor</tt> for a <tt>SessionFactory</tt>, or a new instance ! * might be specified for each <tt>Session</tt>. Whichever approach is used, the interceptor must be ! * serializable if the <tt>Session</tt> is to be serializable. This means that <tt>SessionFactory</tt>-scoped * interceptors should implement <tt>readResolve()</tt>.<br> * <br> ! * The <tt>Session</tt> may not be invoked from a callback (nor may a callback cause a collection or proxy to * be lazily initialized).<br> ! * * @see SessionFactory#openSession(Interceptor) * @see Datastore#buildSessionFactory(Interceptor) *************** *** 24,34 **** public interface Interceptor { /** ! * Called just before an object is initialized. The interceptor may change the <tt>state</tt>, which will ! * be propagated to the persistent object. Note that when this method is called, <tt>entity</tt> will be * an empty uninitialized instance of the class. ! * * @return <tt>true</tt> if the user modified the <tt>state</tt> in any way. */ ! public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types); /** * Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected --- 24,34 ---- public interface Interceptor { /** ! * Called just before an object is initialized. The interceptor may change the <tt>state</tt>, which will ! * be propagated to the persistent object. Note that when this method is called, <tt>entity</tt> will be * an empty uninitialized instance of the class. ! * * @return <tt>true</tt> if the user modified the <tt>state</tt> in any way. */ ! public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types); /** * Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected *************** *** 37,41 **** * new <tt>currentState</tt> will be propagated to the object, but not necessarily (immediately) to * the database. It is strongly recommended that the interceptor <b>not</b> modify the <tt>previousState</tt>. ! * * @return <tt>true</tt> if the user modified the <tt>currentState</tt> in any way. */ --- 37,41 ---- * new <tt>currentState</tt> will be propagated to the object, but not necessarily (immediately) to * the database. It is strongly recommended that the interceptor <b>not</b> modify the <tt>previousState</tt>. ! * * @return <tt>true</tt> if the user modified the <tt>currentState</tt> in any way. */ *************** *** 45,49 **** * Called before an object is saved. The interceptor may modify the <tt>state</tt>, which will be used for * the SQL <tt>INSERT</tt> and propagated to the persistent object. ! * * @return <tt>true</tt> if the user modified the <tt>state</tt> in any way. */ --- 45,49 ---- * Called before an object is saved. The interceptor may modify the <tt>state</tt>, which will be used for * the SQL <tt>INSERT</tt> and propagated to the persistent object. ! * * @return <tt>true</tt> if the user modified the <tt>state</tt> in any way. */ *************** *** 63,64 **** --- 63,67 ---- public void postFlush(Iterator entities); } + + + Index: LazyInitializationException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/LazyInitializationException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** LazyInitializationException.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- LazyInitializationException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 16,25 **** super("Hibernate lazy instantiation problem", root); } ! public LazyInitializationException(String msg) { super(msg); LogFactory.getLog(LazyInitializationException.class).error(msg, this); } ! public LazyInitializationException(String msg, Exception root) { super(msg, root); --- 16,25 ---- super("Hibernate lazy instantiation problem", root); } ! public LazyInitializationException(String msg) { super(msg); LogFactory.getLog(LazyInitializationException.class).error(msg, this); } ! public LazyInitializationException(String msg, Exception root) { super(msg, root); *************** *** 33,36 **** return (Exception) super.getCause(); } ! } --- 33,39 ---- return (Exception) super.getCause(); } ! } + + + Index: Lifecycle.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Lifecycle.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Lifecycle.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- Lifecycle.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 38,52 **** */ public interface Lifecycle { ! /** * Return value to veto the action (true) */ public static final boolean VETO = true; ! /** * Return value to accept the action (false) */ public static final boolean NO_VETO = false; ! /** * Called when an entity is saved. --- 38,52 ---- */ public interface Lifecycle { ! /** * Return value to veto the action (true) */ public static final boolean VETO = true; ! /** * Return value to accept the action (false) */ public static final boolean NO_VETO = false; ! /** * Called when an entity is saved. *************** *** 56,60 **** */ public boolean onSave(Session s) throws CallbackException; ! /** * Called when an entity is passed to <tt>Session.update()</tt>. --- 56,60 ---- */ public boolean onSave(Session s) throws CallbackException; ! /** * Called when an entity is passed to <tt>Session.update()</tt>. *************** *** 66,70 **** */ public boolean onUpdate(Session s) throws CallbackException; ! /** * Called when an entity is deleted. --- 66,70 ---- */ public boolean onUpdate(Session s) throws CallbackException; ! /** * Called when an entity is deleted. *************** *** 74,78 **** */ public boolean onDelete(Session s) throws CallbackException; ! /** * Called after an entity is loaded. <em>It is illegal to --- 74,78 ---- */ public boolean onDelete(Session s) throws CallbackException; ! /** * Called after an entity is loaded. <em>It is illegal to *************** *** 86,87 **** --- 86,90 ---- public void onLoad(Session s, Serializable id); } + + + Index: LockMode.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/LockMode.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** LockMode.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- LockMode.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 7,17 **** /** ! * Instances represent a lock mode for a row of a relational ! * database table. It is not intended that users spend much * time worrying about locking since Hibernate usually * obtains exactly the right lock level automatically. ! * Some "advanced" users may wish to explicitly specify lock * levels. ! * * @see Session#lock(Object,LockMode) */ --- 7,17 ---- /** ! * Instances represent a lock mode for a row of a relational ! * database table. It is not intended that users spend much * time worrying about locking since Hibernate usually * obtains exactly the right lock level automatically. ! * Some "advanced" users may wish to explicitly specify lock * levels. ! * * @see Session#lock(Object,LockMode) */ *************** *** 41,45 **** } /** ! * No lock required. If an object is requested with this lock * mode, a <tt>READ</tt> lock might be obtained if necessary. */ --- 41,45 ---- } /** ! * No lock required. If an object is requested with this lock * mode, a <tt>READ</tt> lock might be obtained if necessary. */ *************** *** 51,55 **** public static final LockMode READ = new LockMode(5, "READ"); /** ! * An upgrade lock. Objects loaded in this lock mode are * materialized using an SQL <tt>select ... for update</tt>. */ --- 51,55 ---- public static final LockMode READ = new LockMode(5, "READ"); /** ! * An upgrade lock. Objects loaded in this lock mode are * materialized using an SQL <tt>select ... for update</tt>. */ *************** *** 57,62 **** /** * Attempt to obtain an upgrade lock, using an Oracle-style ! * <tt>select ... for update nowait</tt>. The semantics of ! * this lock mode, once obtained, are the same as * <tt>UPGRADE</tt>.<br> */ --- 57,62 ---- /** * Attempt to obtain an upgrade lock, using an Oracle-style ! * <tt>select ... for update nowait</tt>. The semantics of ! * this lock mode, once obtained, are the same as * <tt>UPGRADE</tt>.<br> */ *************** *** 68,72 **** */ public static final LockMode WRITE = new LockMode(10, "WRITE"); ! static { instances.put( new Integer(NONE.level), NONE ); --- 68,72 ---- */ public static final LockMode WRITE = new LockMode(10, "WRITE"); ! static { instances.put( new Integer(NONE.level), NONE ); *************** *** 80,83 **** return instances.get( new Integer(level) ); } ! } --- 80,86 ---- return instances.get( new Integer(level) ); } ! } + + + Index: MappingException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/MappingException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MappingException.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- MappingException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 9,16 **** public class MappingException extends HibernateException { ! public MappingException(String msg, Throwable root) { ! super( msg, root ); ! } ! public MappingException(Throwable root) { super(root); --- 9,16 ---- public class MappingException extends HibernateException { ! public MappingException(String msg, Throwable root) { ! super( msg, root ); ! } ! public MappingException(Throwable root) { super(root); *************** *** 22,23 **** --- 22,26 ---- } + + + Index: ObjectDeletedException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/ObjectDeletedException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ObjectDeletedException.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- ObjectDeletedException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 23,27 **** return super.getMessage() + ": " + identifier; } ! } --- 23,30 ---- return super.getMessage() + ": " + identifier; } ! } + + + Index: ObjectNotFoundException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/ObjectNotFoundException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ObjectNotFoundException.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- ObjectNotFoundException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 25,33 **** return super.getMessage() + ": " + identifier + ", of class: " + clazz.getName(); } ! public Class getPersistentClass() { return clazz; } ! } --- 25,36 ---- return super.getMessage() + ": " + identifier + ", of class: " + clazz.getName(); } ! public Class getPersistentClass() { return clazz; } ! } + + + Index: PersistentEnum.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/PersistentEnum.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PersistentEnum.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- PersistentEnum.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 9,13 **** * <br> * <tt>public static PersistentEnum fromInt(int i)</tt> ! * */ --- 9,13 ---- * <br> * <tt>public static PersistentEnum fromInt(int i)</tt> ! * */ *************** *** 15,16 **** --- 15,19 ---- public int toInt(); } + + + Index: PersistentObjectException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/PersistentObjectException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PersistentObjectException.java 1 Jan 2003 13:53:47 -0000 1.1.1.1 --- PersistentObjectException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 8,15 **** public class PersistentObjectException extends HibernateException { ! public PersistentObjectException(String s) { super(s); } ! } --- 8,18 ---- public class PersistentObjectException extends HibernateException { ! public PersistentObjectException(String s) { super(s); } ! } + + + Index: PropertyAccessException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/PropertyAccessException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PropertyAccessException.java 1 Jan 2003 13:53:48 -0000 1.1.1.1 --- PropertyAccessException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 3,7 **** /** ! * A problem occurred accessing a property of an instance of a * persistent class by reflection. */ --- 3,7 ---- /** ! * A problem occurred accessing a property of an instance of a * persistent class by reflection. */ *************** *** 12,16 **** private final String propertyName; private final boolean wasSetter; ! public PropertyAccessException(Exception root, String s, boolean wasSetter, Class persistentClass, String propertyName) { super(s, root); --- 12,16 ---- private final String propertyName; private final boolean wasSetter; ! public PropertyAccessException(Exception root, String s, boolean wasSetter, Class persistentClass, String propertyName) { super(s, root); *************** *** 19,27 **** this.propertyName = propertyName; } ! public Class getPersistentClass() { return persistentClass; } ! public String getPropertyName() { return propertyName; --- 19,27 ---- this.propertyName = propertyName; } ! public Class getPersistentClass() { return persistentClass; } ! public String getPropertyName() { return propertyName; *************** *** 29,37 **** public String getMessage() { ! return super.getMessage() + ! ( wasSetter ? " setter of " : " getter of ") + ! persistentClass.getName() + ! '.' + ! propertyName; } } --- 29,40 ---- public String getMessage() { ! return super.getMessage() + ! ( wasSetter ? " setter of " : " getter of ") + ! persistentClass.getName() + ! '.' + ! propertyName; } } + + + Index: PropertyNotFoundException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/PropertyNotFoundException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PropertyNotFoundException.java 1 Jan 2003 13:53:48 -0000 1.1.1.1 --- PropertyNotFoundException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 3,22 **** /** ! * Indicates that an expected getter or setter method could not be * found on a class. */ public class PropertyNotFoundException extends MappingException { ! public PropertyNotFoundException(String msg, Throwable root) { super(msg, root); } ! public PropertyNotFoundException(Throwable root) { super(root); } ! public PropertyNotFoundException(String s) { super(s); } ! } --- 3,25 ---- /** ! * Indicates that an expected getter or setter method could not be * found on a class. */ public class PropertyNotFoundException extends MappingException { ! public PropertyNotFoundException(String msg, Throwable root) { super(msg, root); } ! public PropertyNotFoundException(Throwable root) { super(root); } ! public PropertyNotFoundException(String s) { super(s); } ! } + + + Index: Query.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Query.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Query.java 1 Jan 2003 13:53:48 -0000 1.1.1.1 --- Query.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 63,68 **** public String[] getNamedParameters() throws HibernateException; /** ! * Return the query results as an <tt>Iterator</tt>. If the query ! * contains multiple results pre row, the results are returned in * an instance of <tt>Object[]</tt>.<br> * <br> --- 63,68 ---- public String[] getNamedParameters() throws HibernateException; /** ! * Return the query results as an <tt>Iterator</tt>. If the query ! * contains multiple results pre row, the results are returned in * an instance of <tt>Object[]</tt>.<br> * <br> *************** *** 76,81 **** public Iterator iterate() throws SQLException, HibernateException; /** ! * Return the query results as <tt>ScrollableResults</tt>. The ! * scrollability of the returned results depends upon JDBC driver * support for scrollable <tt>ResultSet</tt>s.<br> * <br> --- 76,81 ---- public Iterator iterate() throws SQLException, HibernateException; /** ! * Return the query results as <tt>ScrollableResults</tt>. The ! * scrollability of the returned results depends upon JDBC driver * support for scrollable <tt>ResultSet</tt>s.<br> * <br> *************** *** 107,111 **** public void setMaxResults(int maxResults); /** ! * Set the first row to retrieve. If not set, rows will be * retrieved beginnning from row <tt>0</tt>. This method * is more efficient if the JDBC driver supports scrollable --- 107,111 ---- public void setMaxResults(int maxResults); /** ! * Set the first row to retrieve. If not set, rows will be * retrieved beginnning from row <tt>0</tt>. This method * is more efficient if the JDBC driver supports scrollable *************** *** 138,142 **** /** ! * Bind a value to a JDBC-style query parameter, guessing the * Hibernate type from the class of the given object. * @param position the position of the parameter in the query --- 138,142 ---- /** ! * Bind a value to a JDBC-style query parameter, guessing the * Hibernate type from the class of the given object. * @param position the position of the parameter in the query *************** *** 166,170 **** /** * Bind multiple values to a named query parameter, guessing the Hibernate type from the ! * class of the first object in the collection. This is useful for binding a list of values * to an expression such as <tt>foo.bar in (:value_list)</tt>. * @param name the name of the parameter --- 166,170 ---- /** * Bind multiple values to a named query parameter, guessing the Hibernate type from the ! * class of the first object in the collection. This is useful for binding a list of values * to an expression such as <tt>foo.bar in (:value_list)</tt>. * @param name the name of the parameter *************** *** 219,223 **** public void setTime(String name, Date date); public void setTimestamp(String name, Date date); ! public void setCalendar(String name, Calendar calendar); public void setCalendarDate(String name, Calendar calendar); --- 219,223 ---- public void setTime(String name, Date date); public void setTimestamp(String name, Date date); ! public void setCalendar(String name, Calendar calendar); public void setCalendarDate(String name, Calendar calendar); *************** *** 237,241 **** */ public void setEnum(int position, Object val) throws MappingException; // use setParameter for null values ! /** * Bind an instance of a mapped persistent class to a named query parameter. --- 237,241 ---- */ public void setEnum(int position, Object val) throws MappingException; // use setParameter for null values ! /** * Bind an instance of a mapped persistent class to a named query parameter. *************** *** 251,253 **** --- 251,256 ---- public void setEnum(String name, Object val) throws MappingException; // use setParameter for null values } + + + Index: QueryException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/QueryException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** QueryException.java 1 Jan 2003 13:53:48 -0000 1.1.1.1 --- QueryException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 22,26 **** return queryString; } ! public void setQueryString(String queryString) { this.queryString = queryString; --- 22,26 ---- return queryString; } ! public void setQueryString(String queryString) { this.queryString = queryString; *************** *** 30,34 **** return super.getMessage() + " [" + queryString + ']'; } ! } --- 30,37 ---- return super.getMessage() + " [" + queryString + ']'; } ! } + + + Index: ScrollableResults.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/ScrollableResults.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ScrollableResults.java 1 Jan 2003 13:53:49 -0000 1.1.1.1 --- ScrollableResults.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 21,25 **** * <br> * Contrary to JDBC, columns of results are numbered from zero. ! * * @see Query#scroll() */ --- 21,25 ---- * <br> * Contrary to JDBC, columns of results are numbered from zero. ! * * @see Query#scroll() */ *************** *** 36,40 **** * @return <tt>true</tt> if there is a previous result */ ! public boolean previous() throws SQLException, HibernateException; /** * Scroll an arbitrary number of locations --- 36,40 ---- * @return <tt>true</tt> if there is a previous result */ ! public boolean previous() throws SQLException, HibernateException; /** * Scroll an arbitrary number of locations *************** *** 75,79 **** * Get the <tt>i</tt>th object in the current row of results, without * initializing any other results in the row. This method may be used ! * safely, regardless of the type of the column (ie. even for scalar * results). * @param i the column, numbered from zero --- 75,79 ---- * Get the <tt>i</tt>th object in the current row of results, without * initializing any other results in the row. This method may be used ! * safely, regardless of the type of the column (ie. even for scalar * results). * @param i the column, numbered from zero *************** *** 88,92 **** */ public Type getType(int i); ! /** * Convenience method to read an <tt>integer</tt> --- 88,92 ---- */ public Type getType(int i); ! /** * Convenience method to read an <tt>integer</tt> *************** *** 125,136 **** */ public byte[] getBinary(int col) throws SQLException, HibernateException; ! /** ! * Convenience method to read a <tt>blob</tt> ! */ ! public Blob getBlob(int col) throws SQLException, HibernateException; ! /** ! * Convenience method to read a <tt>clob</tt> ! */ ! public Clob getClob(int col) throws SQLException, HibernateException; /** * Convenience method to read a <tt>string</tt> --- 125,136 ---- */ public byte[] getBinary(int col) throws SQLException, HibernateException; ! /** ! * Convenience method to read a <tt>blob</tt> ! */ ! public Blob getBlob(int col) throws SQLException, HibernateException; ! /** ! * Convenience method to read a <tt>clob</tt> ! */ ! public Clob getClob(int col) throws SQLException, HibernateException; /** * Convenience method to read a <tt>string</tt> *************** *** 162,163 **** --- 162,166 ---- public TimeZone getTimeZone(int col) throws SQLException, HibernateException; } + + + Index: Session.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Session.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Session.java 1 Jan 2003 13:53:51 -0000 1.1.1.1 --- Session.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 13,17 **** * central API class abstracting the notion of a persistence service.<br> * <br> ! * The lifecycle of a <tt>Session</tt> is bounded by the beginning and end of a logical * transaction. (Long transactions might span several database transactions.)<br> * <br> --- 13,17 ---- * central API class abstracting the notion of a persistence service.<br> * <br> ! * The lifecycle of a <tt>Session</tt> is bounded by the beginning and end of a logical * transaction. (Long transactions might span several database transactions.)<br> [...974 lines suppressed...] ! * @param queryString a Hibernate query ! * @return Query ! * @throws HibernateException ! */ ! public Query createFilter(Object collection, String queryString) throws HibernateException; ! ! /** ! * Obtain an instance of <tt>Query</tt> for a named query string defined in the ! * mapping file. ! * ! * @param queryString the name of a query defined externally ! * @return Query ! * @throws HibernateException ! */ ! public Query getNamedQuery(String queryName) throws HibernateException; ! ! } ! ! ! Index: SessionFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/SessionFactory.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SessionFactory.java 1 Jan 2003 13:53:51 -0000 1.1.1.1 --- SessionFactory.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 12,16 **** import net.sf.hibernate.metadata.CollectionMetadata; ! /** * Creates <tt>Session</tt>s. Usually an application has a single * <tt>SessionFactory</tt>. Threads servicing client requests obtain --- 12,16 ---- import net.sf.hibernate.metadata.CollectionMetadata; ! /** * Creates <tt>Session</tt>s. Usually an application has a single * <tt>SessionFactory</tt>. Threads servicing client requests obtain *************** *** 22,26 **** * Properties may be either be <tt>System</tt> properties, properties * defined in a resource named <tt>/hibernate.properties</tt> in ! * the classpath or a <tt>java.util.Properties</tt> passed to * <tt>Datastore.buildSessionFactory()</tt><br> * <br> --- 22,26 ---- * Properties may be either be <tt>System</tt> properties, properties * defined in a resource named <tt>/hibernate.properties</tt> in ! * the classpath or a <tt>java.util.Properties</tt> passed to * <tt>Datastore.buildSessionFactory()</tt><br> * <br> *************** *** 33,37 **** * <tr> * <td><tt>hibernate.connection.provider_class</tt></td> ! * <td>classname of <tt>net.sf.hibernate.connection.ConnectionProvider</tt> * subclass (if not specified hueristics are used)</td> * </tr> --- 33,37 ---- * <tr> * <td><tt>hibernate.connection.provider_class</tt></td> ! * <td>classname of <tt>net.sf.hibernate.connection.ConnectionProvider</tt> * subclass (if not specified hueristics are used)</td> * </tr> *************** *** 48,57 **** * <tr> * <td><tt>hibernate.connection.isolation</tt></td> ! * <td>JDBC transaction isolation level (only when using * <tt>java.sql.DriverManager</tt>) * </td> * </tr> * <td><tt>hibernate.connection.pool_size</tt></td> ! * <td>the maximum size of the connection pool (only when using * <tt>java.sql.DriverManager</tt>) * </td> --- 48,57 ---- * <tr> * <td><tt>hibernate.connection.isolation</tt></td> ! * <td>JDBC transaction isolation level (only when using * <tt>java.sql.DriverManager</tt>) * </td> * </tr> * <td><tt>hibernate.connection.pool_size</tt></td> ! * <td>the maximum size of the connection pool (only when using * <tt>java.sql.DriverManager</tt>) * </td> *************** *** 59,63 **** * <tr> * <td><tt>hibernate.statement_cache.size</tt></td> ! * <td>the maximum size of the prepared statement cache (only when using * <tt>java.sql.DriverManager</tt>) * </td> --- 59,63 ---- * <tr> * <td><tt>hibernate.statement_cache.size</tt></td> ! * <td>the maximum size of the prepared statement cache (only when using * <tt>java.sql.DriverManager</tt>) * </td> *************** *** 96,100 **** * <tr> * <td><tt>hibernate.session_factory_name</tt></td> ! * <td>If set, the factory attempts to bind this name to itself in the * JNDI context. This name is also used to support cross JVM <tt> * Session</tt> (de)serialization.</td> --- 96,100 ---- * <tr> * <td><tt>hibernate.session_factory_name</tt></td> ! * <td>If set, the factory attempts to bind this name to itself in the * JNDI context. This name is also used to support cross JVM <tt> * Session</tt> (de)serialization.</td> *************** *** 112,116 **** * </tr> * </table> ! * * @see Datastore * @see Session --- 112,116 ---- * </tr> * </table> ! * * @see Datastore * @see Session *************** *** 122,126 **** /** * Open a <tt>Session</tt> on the given connection. ! * * @param connection a connection provided by the application. * @return Session --- 122,126 ---- /** * Open a <tt>Session</tt> on the given connection. ! * * @param connection a connection provided by the application. * @return Session *************** *** 129,135 **** /** ! * Create database connection and open a <tt>Session</tt> on it, specifying an * interceptor. ! * * @param interceptor a session-scoped interceptor * @return Session --- 129,135 ---- /** ! * Create database connection and open a <tt>Session</tt> on it, specifying an * interceptor. ! * * @param interceptor a session-scoped interceptor * @return Session *************** *** 140,144 **** /** * Open a <tt>Session</tt> on the given connection, specifying an interceptor. ! * * @param connection a connection provided by the application. * @param interceptor a session-scoped interceptor --- 140,144 ---- /** * Open a <tt>Session</tt> on the given connection, specifying an interceptor. ! * * @param connection a connection provided by the application. * @param interceptor a session-scoped interceptor *************** *** 149,153 **** /** * Create database connection and open a <tt>Session</tt> on it. ! * * @return Session * @throws SQLException --- 149,153 ---- /** * Create database connection and open a <tt>Session</tt> on it. ! * * @return Session * @throws SQLException *************** *** 157,161 **** /** * Create a new databinder. ! * * @return Databinder */ --- 157,161 ---- /** * Create a new databinder. ! * * @return Databinder */ *************** *** 164,196 **** /** * Get the <tt>ClassMetadata</tt> associated with the given entity class ! * * @see net.sf.hibernate.metadata.ClassMetadata */ public ClassMetadata getClassMetadata(Class persistentClass) throws HibernateException; ! /** * Get the <tt>CollectionMetadata</tt> associated with the named collection role ! * * @see net.sf.hibernate.metadata.CollectionMetadata */ public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException; - /** - *... [truncated message content] |
From: <one...@us...> - 2003-01-04 11:16:00
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/collection Modified Files: ArrayHolder.java Bag.java CollectionPersister.java List.java Map.java ODMGCollection.java PersistentCollection.java Set.java SortedMap.java SortedSet.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: ArrayHolder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ArrayHolder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ArrayHolder.java 3 Jan 2003 13:36:00 -0000 1.2 --- ArrayHolder.java 4 Jan 2003 11:15:27 -0000 1.3 *************** *** 18,22 **** import net.sf.hibernate.engine.SessionImplementor; ! /** * A persistent wrapper for an array. Lazy initialization * is NOT supported. --- 18,22 ---- import net.sf.hibernate.engine.SessionImplementor; ! /** * A persistent wrapper for an array. Lazy initialization * is NOT supported. *************** *** 57,61 **** super(session); elementClass = persister.getElementClass(); ! } public Object getArray() { return array; --- 57,61 ---- super(session); elementClass = persister.getElementClass(); ! } public Object getArray() { return array; *************** *** 70,74 **** return true; } ! /** * @see PersistentCollection#replaceElements(Map) --- 70,74 ---- return true; } ! /** * @see PersistentCollection#replaceElements(Map) *************** *** 80,87 **** Object r; if ( val!=null && ( r=replacements.get(val) )!=null ) ! Array.set(array, i, r); } } ! /** * @see PersistentCollection#elements() --- 80,87 ---- Object r; if ( val!=null && ( r=replacements.get(val) )!=null ) ! Array.set(array, i, r); } } ! /** * @see PersistentCollection#elements() *************** *** 99,118 **** return false; } ! /** * @see PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { ! persister.writeElement(st, entry, writeOrder, session); persister.writeIndex(st, new Integer(i), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) ! throws HibernateException, SQLException { // relys on the fact that elements are returned sorted by index! --- 99,118 ---- return false; } ! /** * @see PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { ! persister.writeElement(st, entry, writeOrder, session); persister.writeIndex(st, new Integer(i), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) ! throws HibernateException, SQLException { // relys on the fact that elements are returned sorted by index! *************** *** 126,130 **** return element; } ! /** * @see PersistentCollection#entries() --- 126,130 ---- return element; } ! /** * @see PersistentCollection#entries() *************** *** 148,154 **** //Arrays have to do things a bit differently. ! public Object getInitialValue(boolean lazy) throws SQLException, HibernateException { ! temp = new ArrayList(); super.getInitialValue(false); --- 148,154 ---- //Arrays have to do things a bit differently. ! public Object getInitialValue(boolean lazy) throws SQLException, HibernateException { ! temp = new ArrayList(); super.getInitialValue(false); *************** *** 157,166 **** Array.set(array, i, temp.get(i) ); } ! session.addArrayHolder(this); temp=null; return array; } ! public void beforeInitialize(CollectionPersister persister) { //if (temp==null) throw new UnsupportedOperationException("Can't lazily initialize arrays"); --- 157,166 ---- Array.set(array, i, temp.get(i) ); } ! session.addArrayHolder(this); temp=null; return array; } ! public void beforeInitialize(CollectionPersister persister) { //if (temp==null) throw new UnsupportedOperationException("Can't lazily initialize arrays"); *************** *** 170,177 **** return true; } ! ! public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { Object[] cached = (Object[]) array; --- 170,177 ---- return true; } ! ! public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { Object[] cached = (Object[]) array; *************** *** 182,186 **** Array.set(array, i, persister.getElementType().assemble( (Serializable) cached[i], session, null) ); } ! } --- 182,186 ---- Array.set(array, i, persister.getElementType().assemble( (Serializable) cached[i], session, null) ); } ! } *************** *** 193,204 **** } return result; ! } ! public Object getCachedValue() { session.addArrayHolder(this); return array; } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); --- 193,204 ---- } return result; ! } ! public Object getCachedValue() { session.addArrayHolder(this); return array; } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); *************** *** 209,217 **** return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { return i >= Array.getLength(getSnapshot()); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { Serializable snapshot = getSnapshot(); --- 209,217 ---- return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { return i >= Array.getLength(getSnapshot()); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { Serializable snapshot = getSnapshot(); *************** *** 224,228 **** return new Integer(i); } ! } --- 224,231 ---- return new Integer(i); } ! } + + + Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Bag.java 3 Jan 2003 14:07:30 -0000 1.3 --- Bag.java 4 Jan 2003 11:15:27 -0000 1.4 *************** *** 24,28 **** private java.util.List bag; ! public Bag(SessionImplementor session) { super(session); --- 24,28 ---- private java.util.List bag; ! public Bag(SessionImplementor session) { super(session); *************** *** 43,47 **** initialized = true; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#elements() --- 43,47 ---- initialized = true; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#elements() *************** *** 53,57 **** return bag.isEmpty(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#replaceElements(Map) --- 53,57 ---- return bag.isEmpty(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#replaceElements(Map) *************** *** 64,68 **** } } ! /** * @see net.sf.hibernate.collections.PersistentCollection#entries() --- 64,68 ---- } } ! /** * @see net.sf.hibernate.collections.PersistentCollection#entries() *************** *** 71,75 **** return bag.iterator(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#readEntries(Iterator) --- 71,75 ---- return bag.iterator(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#readEntries(Iterator) *************** *** 80,84 **** } } ! /** * @see net.sf.hibernate.collections.PersistentCollection#readFrom(ResultSet, CollectionPersister) --- 80,84 ---- } } ! /** * @see net.sf.hibernate.collections.PersistentCollection#readFrom(ResultSet, CollectionPersister) *************** *** 89,101 **** return element; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int, boolean) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { persister.writeElement(st, entry, writeOrder, session); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#beforeInitialize() --- 89,101 ---- return element; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int, boolean) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { persister.writeElement(st, entry, writeOrder, session); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#beforeInitialize() *************** *** 104,108 **** this.bag = new ArrayList(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#equalsSnapshot(Serializable, Type) --- 104,108 ---- this.bag = new ArrayList(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#equalsSnapshot(Serializable, Type) *************** *** 127,137 **** return result; } ! ! /** * @see net.sf.hibernate.collections.PersistentCollection#snapshot(CollectionPersister, SessionImplementor) */ protected Serializable snapshot(CollectionPersister persister) ! throws HibernateException { ArrayList clonedList = new ArrayList( bag.size() ); Iterator iter = bag.iterator(); --- 127,137 ---- return result; } ! ! /** * @see net.sf.hibernate.collections.PersistentCollection#snapshot(CollectionPersister, SessionImplementor) */ protected Serializable snapshot(CollectionPersister persister) ! throws HibernateException { ArrayList clonedList = new ArrayList( bag.size() ); Iterator iter = bag.iterator(); *************** *** 141,151 **** return clonedList; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#disassemble(CollectionPersister, SessionImplementor) */ public Serializable disassemble(CollectionPersister persister) ! throws HibernateException { ! int length = bag.size(); ArrayList result = new ArrayList(length); --- 141,151 ---- return clonedList; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#disassemble(CollectionPersister, SessionImplementor) */ public Serializable disassemble(CollectionPersister persister) ! throws HibernateException { ! int length = bag.size(); ArrayList result = new ArrayList(length); *************** *** 155,164 **** return result; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#assemble(CollectionPersister, SessionImplementor) */ public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { int length = bag.size(); java.util.List old = bag; --- 155,164 ---- return result; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#assemble(CollectionPersister, SessionImplementor) */ public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { int length = bag.size(); java.util.List old = bag; *************** *** 168,189 **** } } ! public boolean needsRecreate(Type elemType) throws HibernateException { return true; } ! ! public Iterator getDeletes(Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! /** * @see java.util.Collection#size() --- 168,189 ---- } } ! public boolean needsRecreate(Type elemType) throws HibernateException { return true; } ! ! public Iterator getDeletes(Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! /** * @see java.util.Collection#size() *************** *** 193,197 **** return bag.size(); } ! /** * @see java.util.Collection#isEmpty() --- 193,197 ---- return bag.size(); } ! /** * @see java.util.Collection#isEmpty() *************** *** 201,205 **** return bag.isEmpty(); } ! /** * @see java.util.Collection#contains(Object) --- 201,205 ---- return bag.isEmpty(); } ! /** * @see java.util.Collection#contains(Object) *************** *** 209,213 **** return bag.contains(o); } ! /** * @see java.util.Collection#iterator() --- 209,213 ---- return bag.contains(o); } ! /** * @see java.util.Collection#iterator() *************** *** 217,221 **** return new IteratorProxy( bag.iterator() ); } ! /** * @see java.util.Collection#toArray() --- 217,221 ---- return new IteratorProxy( bag.iterator() ); } ! /** * @see java.util.Collection#toArray() *************** *** 225,229 **** return bag.toArray(); } ! /** * @see java.util.Collection#toArray(Object[]) --- 225,229 ---- return bag.toArray(); } ! /** * @see java.util.Collection#toArray(Object[]) *************** *** 233,237 **** return bag.toArray(a); } ! /** * @see java.util.Collection#add(Object) --- 233,237 ---- return bag.toArray(a); } ! /** * @see java.util.Collection#add(Object) *************** *** 246,250 **** } } ! /** * @see java.util.Collection#remove(Object) --- 246,250 ---- } } ! /** * @see java.util.Collection#remove(Object) *************** *** 254,258 **** return bag.remove(o); } ! /** * @see java.util.Collection#containsAll(Collection) --- 254,258 ---- return bag.remove(o); } ! /** * @see java.util.Collection#containsAll(Collection) *************** *** 262,266 **** return bag.containsAll(c); } ! /** * @see java.util.Collection#addAll(Collection) --- 262,266 ---- return bag.containsAll(c); } ! /** * @see java.util.Collection#addAll(Collection) *************** *** 275,279 **** } } ! /** * @see java.util.Collection#removeAll(Collection) --- 275,279 ---- } } ! /** * @see java.util.Collection#removeAll(Collection) *************** *** 283,287 **** return bag.removeAll(c); } ! /** * @see java.util.Collection#retainAll(Collection) --- 283,287 ---- return bag.removeAll(c); } ! /** * @see java.util.Collection#retainAll(Collection) *************** *** 291,295 **** return bag.retainAll(c); } ! /** * @see java.util.Collection#clear() --- 291,295 ---- return bag.retainAll(c); } ! /** * @see java.util.Collection#clear() *************** *** 299,303 **** bag.clear(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#getIndex(Object, int) --- 299,303 ---- bag.clear(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#getIndex(Object, int) *************** *** 308,313 **** public Bag() {} ! ! public DBag difference(DBag arg0) { //TODO: perhaps not correct semantics - is it supposed to be symmetric? --- 308,313 ---- public Bag() {} ! ! public DBag difference(DBag arg0) { //TODO: perhaps not correct semantics - is it supposed to be symmetric? *************** *** 318,322 **** return new Bag(session, list); } ! public DBag intersection(DBag bag) { read(); --- 318,322 ---- return new Bag(session, list); } ! public DBag intersection(DBag bag) { read(); *************** *** 326,330 **** return new Bag(session, list); } ! public int occurrences(Object o) { read(); --- 326,330 ---- return new Bag(session, list); } ! public int occurrences(Object o) { read(); *************** *** 336,340 **** return result; } ! public DBag union(DBag bag) { read(); --- 336,340 ---- return result; } ! public DBag union(DBag bag) { read(); *************** *** 344,348 **** return new Bag(session, list); } ! /*public boolean add(Object o, int n) { if (n>0) write(); --- 344,348 ---- return new Bag(session, list); } ! /*public boolean add(Object o, int n) { if (n>0) write(); *************** *** 360,364 **** return n>0; } ! public Set uniqueSet() { Set set = new HashSet( bag.size() ); --- 360,364 ---- return n>0; } ! public Set uniqueSet() { Set set = new HashSet( bag.size() ); *************** *** 384,388 **** // List OPERATIONS: ! /** * @see java.util.List#add(int, Object) --- 384,388 ---- // List OPERATIONS: ! /** * @see java.util.List#add(int, Object) *************** *** 392,396 **** bag.add(i, o); } ! /** * @see java.util.List#addAll(int, Collection) --- 392,396 ---- bag.add(i, o); } ! /** * @see java.util.List#addAll(int, Collection) *************** *** 400,404 **** return bag.addAll(i, c); } ! /** * @see java.util.List#get(int) --- 400,404 ---- return bag.addAll(i, c); } ! /** * @see java.util.List#get(int) *************** *** 408,412 **** return bag.get(i); } ! /** * @see java.util.List#indexOf(Object) --- 408,412 ---- return bag.get(i); } ! /** * @see java.util.List#indexOf(Object) *************** *** 416,420 **** return bag.indexOf(o); } ! /** * @see java.util.List#lastIndexOf(Object) --- 416,420 ---- return bag.indexOf(o); } ! /** * @see java.util.List#lastIndexOf(Object) *************** *** 424,428 **** return bag.lastIndexOf(o); } ! /** * @see java.util.List#listIterator() --- 424,428 ---- return bag.lastIndexOf(o); } ! /** * @see java.util.List#listIterator() *************** *** 432,436 **** return new ListIteratorProxy( bag.listIterator() ); } ! /** * @see java.util.List#listIterator(int) --- 432,436 ---- return new ListIteratorProxy( bag.listIterator() ); } ! /** * @see java.util.List#listIterator(int) *************** *** 440,444 **** return new ListIteratorProxy( bag.listIterator(i) ); } ! /** * @see java.util.List#remove(int) --- 440,444 ---- return new ListIteratorProxy( bag.listIterator(i) ); } ! /** * @see java.util.List#remove(int) *************** *** 448,452 **** return bag.remove(i); } ! /** * @see java.util.List#set(int, Object) --- 448,452 ---- return bag.remove(i); } ! /** * @see java.util.List#set(int, Object) *************** *** 456,460 **** return bag.set(i, o); } ! /** * @see java.util.List#subList(int, int) --- 456,460 ---- return bag.set(i, o); } ! /** * @see java.util.List#subList(int, int) *************** *** 464,473 **** return new ListProxy( bag.subList(start, end) ); } ! public String toString() { read(); return bag.toString(); } ! /*public boolean equals(Object other) { read(); --- 464,473 ---- return new ListProxy( bag.subList(start, end) ); } ! public String toString() { read(); return bag.toString(); } ! /*public boolean equals(Object other) { read(); *************** *** 479,482 **** return bag.hashCode(); }*/ ! } --- 479,485 ---- return bag.hashCode(); }*/ ! } + + + Index: CollectionPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/CollectionPersister.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CollectionPersister.java 3 Jan 2003 13:36:00 -0000 1.1 --- CollectionPersister.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 37,44 **** import org.apache.commons.logging.LogFactory; ! /** * Plugs into an instance of <tt>PersistentCollection</tt>, in order to * implement persistence of that collection while in a particular role. ! * * May be considered an immutable view of the mapping object */ --- 37,44 ---- import org.apache.commons.logging.LogFactory; ! /** * Plugs into an instance of <tt>PersistentCollection</tt>, in order to * implement persistence of that collection while in a particular role. ! * * May be considered an immutable view of the mapping object */ *************** *** 84,88 **** private static final Log log = LogFactory.getLog(CollectionPersister.class); ! public CollectionPersister(Collection collection, DatastoreImpl datastore, String defaultSchema, SessionFactoryImplementor factory) throws MappingException, CacheException { --- 84,88 ---- private static final Log log = LogFactory.getLog(CollectionPersister.class); ! public CollectionPersister(Collection collection, DatastoreImpl datastore, String defaultSchema, SessionFactoryImplementor factory) throws MappingException, CacheException { *************** *** 145,152 **** elementColumnNames[i] = col.getName(); i++; ! } } unquotedElementColumnNames = StringHelper.unQuote(elementColumnNames); ! if ( hasIndex = collection.isIndexed() ) { --- 145,152 ---- elementColumnNames[i] = col.getName(); i++; ! } } unquotedElementColumnNames = StringHelper.unQuote(elementColumnNames); ! if ( hasIndex = collection.isIndexed() ) { *************** *** 192,209 **** loader = createCollectionQuery(factory); ! } ! public CollectionInitializer getInitializer() { return loader; } ! private CollectionInitializer createCollectionQuery(SessionFactoryImplementor factory) throws MappingException { ! return isOneToMany() ? ! (CollectionInitializer) new OneToManyLoader(this, factory) : ! (CollectionInitializer) new CollectionLoader(this, factory); } ! public void cache(Serializable id, PersistentCollection coll, SessionImplementor s) throws HibernateException { if (cache!=null) cache.put( id, coll.disassemble(this), s.getTimestamp() ); --- 192,209 ---- loader = createCollectionQuery(factory); ! } ! public CollectionInitializer getInitializer() { return loader; } ! private CollectionInitializer createCollectionQuery(SessionFactoryImplementor factory) throws MappingException { ! return isOneToMany() ? ! (CollectionInitializer) new OneToManyLoader(this, factory) : ! (CollectionInitializer) new CollectionLoader(this, factory); } ! public void cache(Serializable id, PersistentCollection coll, SessionImplementor s) throws HibernateException { if (cache!=null) cache.put( id, coll.disassemble(this), s.getTimestamp() ); *************** *** 237,241 **** return sqlOrderByString; } ! public String getSQLOrderByString(String alias) { StringTokenizer tokens = new StringTokenizer(sqlOrderByString, ","); --- 237,241 ---- return sqlOrderByString; } ! public String getSQLOrderByString(String alias) { StringTokenizer tokens = new StringTokenizer(sqlOrderByString, ","); *************** *** 251,255 **** return enableJoinedFetch; } ! public boolean hasOrdering() { return hasOrder; --- 251,255 ---- return enableJoinedFetch; } ! public boolean hasOrdering() { return hasOrder; *************** *** 279,291 **** return sqlDeleteRowString; } ! public Type getKeyType() { return keyType; } ! public Type getIndexType() { return indexType; } ! public Type getElementType() { return elementType; --- 279,291 ---- return sqlDeleteRowString; } ! public Type getKeyType() { return keyType; } ! public Type getIndexType() { return indexType; } ! public Type getElementType() { return elementType; *************** *** 304,326 **** } ! public void writeElement(PreparedStatement st, Object elt, boolean writeOrder, SessionImplementor session) ! throws HibernateException, SQLException { getElementType().nullSafeSet(st, elt, 1+(writeOrder?0:keyColumnNames.length+(hasIndex?indexColumnNames.length:0)), session); } ! ! public void writeIndex(PreparedStatement st, Object idx, boolean writeOrder, SessionImplementor session) ! throws HibernateException, SQLException { getIndexType().nullSafeSet(st, idx, 1+keyColumnNames.length + (writeOrder?elementColumnNames.length:0), session); } ! private void writeRowSelect(PreparedStatement st, Object idx, SessionImplementor session) ! throws HibernateException, SQLException { rowSelectType.nullSafeSet(st, idx, 1+keyColumnNames.length, session); } ! public void writeKey(PreparedStatement st, Serializable id, boolean writeOrder, SessionImplementor session) ! throws HibernateException, SQLException { if ( id==null ) throw new NullPointerException("Null Collection Key"); //an assertion ! getKeyType().nullSafeSet(st, id, 1+(writeOrder?elementColumnNames.length:0), session); } --- 304,326 ---- } ! public void writeElement(PreparedStatement st, Object elt, boolean writeOrder, SessionImplementor session) ! throws HibernateException, SQLException { getElementType().nullSafeSet(st, elt, 1+(writeOrder?0:keyColumnNames.length+(hasIndex?indexColumnNames.length:0)), session); } ! ! public void writeIndex(PreparedStatement st, Object idx, boolean writeOrder, SessionImplementor session) ! throws HibernateException, SQLException { getIndexType().nullSafeSet(st, idx, 1+keyColumnNames.length + (writeOrder?elementColumnNames.length:0), session); } ! private void writeRowSelect(PreparedStatement st, Object idx, SessionImplementor session) ! throws HibernateException, SQLException { rowSelectType.nullSafeSet(st, idx, 1+keyColumnNames.length, session); } ! public void writeKey(PreparedStatement st, Serializable id, boolean writeOrder, SessionImplementor session) ! throws HibernateException, SQLException { if ( id==null ) throw new NullPointerException("Null Collection Key"); //an assertion ! getKeyType().nullSafeSet(st, id, 1+(writeOrder?elementColumnNames.length:0), session); } *************** *** 344,348 **** if ( hasIndex && indexColumnNames.length==1 && ( elementColumnNames[i].equals( indexColumnNames[0] ) ) ) { appendIndex = false; ! } } if ( hasIndex && appendIndex ) { --- 344,348 ---- if ( hasIndex && indexColumnNames.length==1 && ( elementColumnNames[i].equals( indexColumnNames[0] ) ) ) { appendIndex = false; ! } } if ( hasIndex && appendIndex ) { *************** *** 352,359 **** } buf.append( " from " ) ! .append(qualifiedTableName) ! .append( " where " ) ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append( " = ?"); if (hasOrder) buf.append(" order by ").append(sqlOrderByString); return buf.toString(); --- 352,359 ---- } buf.append( " from " ) ! .append(qualifiedTableName) ! .append( " where " ) ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append( " = ?"); if (hasOrder) buf.append(" order by ").append(sqlOrderByString); return buf.toString(); *************** *** 363,387 **** if (isOneToMany) { StringBuffer buf = new StringBuffer("update ") ! .append(qualifiedTableName) ! .append( " set " ) ! .append( StringHelper.join( " = null, ", keyColumnNames ) ) ! .append( " = null" ); if ( hasIndex ) { buf.append(", ") ! .append( StringHelper.join( " = null, ", indexColumnNames ) ) ! .append( " = null" ); } buf.append( " where " ) ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append( " = ?" ); return buf.toString(); } else { return new StringBuffer("delete from ") ! .append(qualifiedTableName) ! .append(" where ") ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append(" = ?") ! .toString(); } } --- 363,387 ---- if (isOneToMany) { StringBuffer buf = new StringBuffer("update ") ! .append(qualifiedTableName) ! .append( " set " ) ! .append( StringHelper.join( " = null, ", keyColumnNames ) ) ! .append( " = null" ); if ( hasIndex ) { buf.append(", ") ! .append( StringHelper.join( " = null, ", indexColumnNames ) ) ! .append( " = null" ); } buf.append( " where " ) ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append( " = ?" ); return buf.toString(); } else { return new StringBuffer("delete from ") ! .append(qualifiedTableName) ! .append(" where ") ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append(" = ?") ! .toString(); } } *************** *** 390,412 **** if (isOneToMany) { StringBuffer buf = new StringBuffer("update ") ! .append(qualifiedTableName) ! .append( " set " ) ! .append( StringHelper.join( " = ?, ", keyColumnNames ) ) ! .append( " = ?"); if (hasIndex) { buf.append( ", " ) ! .append( StringHelper.join( " = ?, ", indexColumnNames ) ) ! .append( " = ?"); } buf.append( " where " ) ! .append( StringHelper.join( " = ? and ", elementColumnNames ) ) ! .append( " = ?" ); return buf.toString(); } else { StringBuffer buf = new StringBuffer("insert into ") ! .append(qualifiedTableName) ! .append(" ( ") ! .append( StringHelper.join( ", ", keyColumnNames ) ); if (hasIndex) { buf.append(", ").append( StringHelper.join(", ", indexColumnNames) ); --- 390,412 ---- if (isOneToMany) { StringBuffer buf = new StringBuffer("update ") ! .append(qualifiedTableName) ! .append( " set " ) ! .append( StringHelper.join( " = ?, ", keyColumnNames ) ) ! .append( " = ?"); if (hasIndex) { buf.append( ", " ) ! .append( StringHelper.join( " = ?, ", indexColumnNames ) ) ! .append( " = ?"); } buf.append( " where " ) ! .append( StringHelper.join( " = ? and ", elementColumnNames ) ) ! .append( " = ?" ); return buf.toString(); } else { StringBuffer buf = new StringBuffer("insert into ") ! .append(qualifiedTableName) ! .append(" ( ") ! .append( StringHelper.join( ", ", keyColumnNames ) ); if (hasIndex) { buf.append(", ").append( StringHelper.join(", ", indexColumnNames) ); *************** *** 417,431 **** buf.append(" ) values ( ?"); buf.append( StringHelper.repeat( ! ", ?", ! elementColumnNames.length + keyColumnNames.length - 1 + ( hasIndex ? indexColumnNames.length:0 ) ) ); return buf.append(" )").toString(); } } ! /*private String sqlSelectRowString() { return ""; //TODO }*/ ! private String sqlUpdateRowString() { if (isOneToMany) { --- 417,431 ---- buf.append(" ) values ( ?"); buf.append( StringHelper.repeat( ! ", ?", ! elementColumnNames.length + keyColumnNames.length - 1 + ( hasIndex ? indexColumnNames.length:0 ) ) ); return buf.append(" )").toString(); } } ! /*private String sqlSelectRowString() { return ""; //TODO }*/ ! private String sqlUpdateRowString() { if (isOneToMany) { *************** *** 434,470 **** else { return new StringBuffer("update ") ! .append(qualifiedTableName) ! .append(" set ") ! .append( StringHelper.join( " = ?, ", elementColumnNames ) ) ! .append(" = ? where ") ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append( " = ? and " ) ! .append( StringHelper.join( " = ? and ", rowSelectColumnNames ) ) ! .append(" = ?") ! .toString(); } } ! private String sqlDeleteRowString() { return new StringBuffer( sqlDeleteString() ) ! .append(" and ") ! .append( StringHelper.join( " = ? and ", rowSelectColumnNames ) ) ! .append(" = ?") ! .toString(); } ! ! public String[] getIndexColumnNames() { return indexColumnNames; } ! public String[] getElementColumnNames() { return elementColumnNames; } ! public String[] getKeyColumnNames() { return keyColumnNames; } ! public boolean isOneToMany() { return isOneToMany; --- 434,470 ---- else { return new StringBuffer("update ") ! .append(qualifiedTableName) ! .append(" set ") ! .append( StringHelper.join( " = ?, ", elementColumnNames ) ) ! .append(" = ? where ") ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append( " = ? and " ) ! .append( StringHelper.join( " = ? and ", rowSelectColumnNames ) ) ! .append(" = ?") ! .toString(); } } ! private String sqlDeleteRowString() { return new StringBuffer( sqlDeleteString() ) ! .append(" and ") ! .append( StringHelper.join( " = ? and ", rowSelectColumnNames ) ) ! .append(" = ?") ! .toString(); } ! ! public String[] getIndexColumnNames() { return indexColumnNames; } ! public String[] getElementColumnNames() { return elementColumnNames; } ! public String[] getKeyColumnNames() { return keyColumnNames; } ! public boolean isOneToMany() { return isOneToMany; *************** *** 480,488 **** return isInverse; } ! public String getQualifiedTableName() { return qualifiedTableName; } ! public final void remove(Serializable id, SessionImplementor session) throws SQLException, HibernateException { --- 480,488 ---- return isInverse; } ! public String getQualifiedTableName() { return qualifiedTableName; } ! public final void remove(Serializable id, SessionImplementor session) throws SQLException, HibernateException { *************** *** 492,496 **** // Remove all the old entries ! PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteString() ); --- 492,496 ---- // Remove all the old entries ! PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteString() ); *************** *** 503,513 **** throw sqle; } ! } } ! public final void recreate(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { if (!isInverse) { --- 503,513 ---- throw sqle; } ! } } ! public final void recreate(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { if (!isInverse) { *************** *** 541,546 **** } ! public final void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { if (!isInverse) { --- 541,546 ---- } ! public final void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { if (!isInverse) { *************** *** 551,555 **** Iterator entries = collection.getDeletes(elementType); if ( entries.hasNext() ) { ! PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteRowString() ); --- 551,555 ---- Iterator entries = collection.getDeletes(elementType); if ( entries.hasNext() ) { ! PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteRowString() ); *************** *** 570,574 **** private final void update(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { ! PreparedStatement st = null; Iterator entries = collection.entries(); --- 570,574 ---- private final void update(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { ! PreparedStatement st = null; Iterator entries = collection.entries(); *************** *** 591,595 **** } } ! private final void updateOneToMany(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { --- 591,595 ---- } } ! private final void updateOneToMany(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { *************** *** 635,639 **** } } ! public final void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { --- 635,639 ---- } } ! public final void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { *************** *** 641,645 **** if ( log.isDebugEnabled() ) log.debug("Updating rows of collection: " + role + "#" + id); ! //update all the modified entries if (isOneToMany) { --- 641,645 ---- if ( log.isDebugEnabled() ) log.debug("Updating rows of collection: " + role + "#" + id); ! //update all the modified entries if (isOneToMany) { *************** *** 651,658 **** } } ! ! public final void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { ! if (!isInverse) { --- 651,658 ---- } } ! ! public final void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { ! if (!isInverse) { *************** *** 681,690 **** } } ! ! public String getRole() { return role; } ! Object readResolve() throws ObjectStreamException { try { --- 681,690 ---- } } ! ! public String getRole() { return role; } ! Object readResolve() throws ObjectStreamException { try { *************** *** 695,699 **** } } ! public boolean isSet() { return isSet; --- 695,699 ---- } } ! public boolean isSet() { return isSet; *************** *** 703,707 **** return ownerClass; } ! } --- 703,710 ---- return ownerClass; } ! } + + + Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** List.java 3 Jan 2003 14:07:30 -0000 1.3 --- List.java 4 Jan 2003 11:15:27 -0000 1.4 *************** *** 20,28 **** ! /** * A persistent wrapper for a java.util.List */ public class List extends ODMGCollection implements java.util.List, DList, DArray { ! private java.util.List list; --- 20,28 ---- ! /** * A persistent wrapper for a java.util.List */ public class List extends ODMGCollection implements java.util.List, DList, DArray { ! private java.util.List list; *************** *** 45,49 **** } return true; ! } public List(SessionImplementor session) { --- 45,49 ---- } return true; ! } public List(SessionImplementor session) { *************** *** 67,71 **** return list.size(); } ! /** * @see List#isEmpty() --- 67,71 ---- return list.size(); } ! /** * @see List#isEmpty() *************** *** 75,79 **** return list.isEmpty(); } ! /** * @see List#contains(Object) --- 75,79 ---- return list.isEmpty(); } ! /** * @see List#contains(Object) *************** *** 83,87 **** return list.contains(object); } ! /** * @see List#iterator() --- 83,87 ---- return list.contains(object); } ! /** * @see List#iterator() *************** *** 91,95 **** return new IteratorProxy( list.iterator() ); } ! /** * @see List#toArray() --- 91,95 ---- return new IteratorProxy( list.iterator() ); } ! /** * @see List#toArray() *************** *** 99,103 **** return list.toArray(); } ! /** * @see List#toArray(Object[]) --- 99,103 ---- return list.toArray(); } ! /** * @see List#toArray(Object[]) *************** *** 107,111 **** return list.toArray(array); } ! /** * @see List#add(Object) --- 107,111 ---- return list.toArray(array); } ! /** * @see List#add(Object) *************** *** 120,124 **** } } ! /** * @see List#remove(Object) --- 120,124 ---- } } ! /** * @see List#remove(Object) *************** *** 128,132 **** return list.remove(arg0); } ! /** * @see List#containsAll(Collection) --- 128,132 ---- return list.remove(arg0); } ! /** * @see List#containsAll(Collection) *************** *** 136,140 **** return list.containsAll( arg0); } ! /** * @see List#addAll(Collection) --- 136,140 ---- return list.containsAll( arg0); } ! /** * @see List#addAll(Collection) *************** *** 149,153 **** } } ! /** * @see List#addAll(int, Collection) --- 149,153 ---- } } ! /** * @see List#addAll(int, Collection) *************** *** 157,161 **** return list.addAll( arg0, arg1); } ! /** * @see List#removeAll(Collection) --- 157,161 ---- return list.addAll( arg0, arg1); } ! /** * @see List#removeAll(Collection) *************** *** 165,169 **** return list.removeAll( arg0); } ! /** * @see List#retainAll(Collection) --- 165,169 ---- return list.removeAll( arg0); } ! /** * @see List#retainAll(Collection) *************** *** 173,177 **** return list.retainAll( arg0); } ! /** * @see List#clear() --- 173,177 ---- return list.retainAll( arg0); } ! /** * @see List#clear() *************** *** 181,185 **** list.clear(); } ! /** * @see List#get(int) --- 181,185 ---- list.clear(); } ! /** * @see List#get(int) *************** *** 189,193 **** return list.get( arg0); } ! /** * @see List#set(int, Object) --- 189,193 ---- return list.get( arg0); } ! /** * @see List#set(int, Object) *************** *** 197,201 **** return list.set( arg0, arg1); } ! /** * @see List#add(int, Object) --- 197,201 ---- return list.set( arg0, arg1); } ! /** * @see List#add(int, Object) *************** *** 205,209 **** list.add(arg0, arg1); } ! /** * @see List#remove(int) --- 205,209 ---- list.add(arg0, arg1); } ! /** * @see List#remove(int) *************** *** 213,217 **** return list.remove( arg0); } ! /** * @see List#indexOf(Object) --- 213,217 ---- return list.remove( arg0); } ! /** * @see List#indexOf(Object) *************** *** 221,225 **** return list.indexOf( arg0); } ! /** * @see List#lastIndexOf(Object) --- 221,225 ---- return list.indexOf( arg0); } ! /** * @see List#lastIndexOf(Object) *************** *** 229,233 **** return list.lastIndexOf( arg0); } ! /** * @see List#listIterator() --- 229,233 ---- return list.lastIndexOf( arg0); } ! /** * @see List#listIterator() *************** *** 237,241 **** return new ListIteratorProxy( list.listIterator() ); } ! /** * @see List#listIterator(int) --- 237,241 ---- return new ListIteratorProxy( list.listIterator() ); } ! /** * @see List#listIterator(int) *************** *** 245,249 **** return new ListIteratorProxy( list.listIterator(arg0) ); } ! /** * @see List#subList(int, int) --- 245,249 ---- return new ListIteratorProxy( list.listIterator(arg0) ); } ! /** * @see List#subList(int, int) *************** *** 253,257 **** return new ListProxy( list.subList(arg0, arg1) ); } ! /** * @see PersistentCollection#replaceElements(Map) --- 253,257 ---- return new ListProxy( list.subList(arg0, arg1) ); } ! /** * @see PersistentCollection#replaceElements(Map) *************** *** 264,268 **** } } ! /** * @see PersistentCollection#elements() --- 264,268 ---- } } ! /** * @see PersistentCollection#elements() *************** *** 274,293 **** return list.isEmpty(); } ! public String toString() { read(); return list.toString(); } ! /** * @see PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { ! persister.writeElement(st, entry, writeOrder, session); persister.writeIndex(st, new Integer(i), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) --- 274,293 ---- return list.isEmpty(); } ! public String toString() { read(); return list.toString(); } ! /** * @see PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { ! persister.writeElement(st, entry, writeOrder, session); persister.writeIndex(st, new Integer(i), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) *************** *** 302,306 **** return element; } ! /** * @see PersistentCollection#entries() --- 302,306 ---- return element; } ! /** * @see PersistentCollection#entries() *************** *** 316,320 **** } public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { int length = list.size(); --- 316,320 ---- } public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { int length = list.size(); *************** *** 324,328 **** list.add( persister.getElementType().assemble( (Serializable) old.get(i), session, null ) ); } ! } --- 324,328 ---- list.add( persister.getElementType().assemble( (Serializable) old.get(i), session, null ) ); } ! } *************** *** 335,341 **** } return result; ! } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); --- 335,341 ---- } return result; ! } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); *************** *** 345,359 **** return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i,Type elemType) throws HibernateException { final java.util.List sn = (java.util.List) getSnapshot(); return i >= sn.size(); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { final java.util.List sn = (java.util.List) getSnapshot(); return i<sn.size() && !elemType.equals( list.get(i), sn.get(i) ); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#getIndex(Object, int) --- 345,359 ---- return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i,Type elemType) throws HibernateException { final java.util.List sn = (java.util.List) getSnapshot(); return i >= sn.size(); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { final java.util.List sn = (java.util.List) getSnapshot(); return i<sn.size() && !elemType.equals( list.get(i), sn.get(i) ); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#getIndex(Object, int) *************** *** 364,368 **** public List() {} ! /** * @see org.odmg.DList#concat(DList) --- 364,368 ---- public List() {} ! /** * @see org.odmg.DList#concat(DList) *************** *** 375,379 **** return new List(session, list); } ! /** * @see org.odmg.DArray#resize(int) --- 375,379 ---- return new List(session, list); } ! /** * @see org.odmg.DArray#resize(int) *************** *** 391,395 **** this.list = newlist; } ! public boolean equals(Object other) { read(); --- 391,395 ---- this.list = newlist; } ! public boolean equals(Object other) { read(); *************** *** 401,405 **** return list.hashCode(); } ! } --- 401,408 ---- return list.hashCode(); } ! } + + + Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Map.java 3 Jan 2003 14:07:30 -0000 1.3 --- Map.java 4 Jan 2003 11:15:27 -0000 1.4 *************** *** 19,23 **** ! /** * A persistent wrapper for a java.util.Map */ --- 19,23 ---- ! /** * A persistent wrapper for a java.util.Map */ *************** *** 25,29 **** protected java.util.Map map; ! public Serializable snapshot(CollectionPersister persister) throws HibernateException { HashMap clonedMap = new HashMap( map.size() ); --- 25,29 ---- protected java.util.Map map; ! public Serializable snapshot(CollectionPersister persister) throws HibernateException { HashMap clonedMap = new HashMap( map.size() ); *************** *** 35,39 **** return clonedMap; } ! public boolean equalsSnapshot(Type elementType) throws HibernateException { java.util.Map xmap = (java.util.Map) getSnapshot(); --- 35,39 ---- return clonedMap; } ! public boolean equalsSnapshot(Type elementType) throws HibernateException { java.util.Map xmap = (java.util.Map) getSnapshot(); *************** *** 68,72 **** return map.size(); } ! /** * @see Map#isEmpty() --- 68,72 ---- return map.size(); } ! /** * @see Map#isEmpty() *************** *** 76,80 **** return map.isEmpty(); } ! /** * @see Map#containsKey(Object) --- 76,80 ---- return map.isEmpty(); } ! /** * @see Map#containsKey(Object) *************** *** 84,88 **** return map.containsKey(arg0); } ! /** * @see Map#containsValue(Object) --- 84,88 ---- return map.containsKey(arg0); } ! /** * @see Map#containsValue(Object) *************** *** 92,96 **** return map.containsValue(arg0) ; } ! /** * @see Map#get(Object) --- 92,96 ---- return map.containsValue(arg0) ; } ! /** * @see Map#get(Object) *************** *** 100,104 **** return map.get(arg0); } ! /** * @see Map#put(Object, Object) --- 100,104 ---- return map.get(arg0); } ! /** * @see Map#put(Object, Object) *************** *** 108,112 **** return map.put( arg0, arg1); } ! /** * @see Map#remove(Object) --- 108,112 ---- return map.put( arg0, arg1); } ! /** * @see Map#remove(Object) *************** *** 116,120 **** return map.remove( arg0); } ! /** * @see Map#putAll(Map) --- 116,120 ---- return map.remove( arg0); } ! /** * @see Map#putAll(Map) *************** *** 124,128 **** map.putAll(arg0); } ! /** * @see Map#clear() --- 124,128 ---- map.putAll(arg0); } ! /** * @see Map#clear() *************** *** 132,136 **** map.clear(); } ! /** * @see Map#keySet() --- 132,136 ---- map.clear(); } ! /** * @see Map#keySet() *************** *** 140,144 **** return new SetProxy( map.keySet() ); } ! /** * @see Map#values() --- 140,144 ---- return new SetProxy( map.keySet() ); } ! /** * @see Map#values() *************** *** 148,152 **** return new SetProxy( map.values() ); } ! /** * @see Map#entrySet() --- 148,152 ---- return new SetProxy( map.values() ); } ! /** * @see Map#entrySet() *************** *** 156,160 **** return new EntrySetProxy( map.entrySet() ); } ! /** * @see PersistentCollection#replaceElements(Map) --- 156,160 ---- return new EntrySetProxy( map.entrySet() ); } ! /** * @see PersistentCollection#replaceElements(Map) *************** *** 172,176 **** if ( n!=replacements.size() ) throw new HibernateException("Application error: don't use mutable values for keys of maps"); } ! /** * @see PersistentCollection#elements() --- 172,176 ---- if ( n!=replacements.size() ) throw new HibernateException("Application error: don't use mutable values for keys of maps"); } ! /** * @see PersistentCollection#elements() *************** *** 182,186 **** return map.isEmpty(); } ! public String toString() { read(); --- 182,186 ---- return map.isEmpty(); } ! public String toString() { read(); *************** *** 191,200 **** */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { java.util.Map.Entry e = (java.util.Map.Entry) entry; persister.writeElement(st, e.getValue(), writeOrder, session); persister.writeIndex(st, e.getKey(), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) --- 191,200 ---- */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { java.util.Map.Entry e = (java.util.Map.Entry) entry; persister.writeElement(st, e.getValue(), writeOrder, session); persister.writeIndex(st, e.getKey(), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) *************** *** 206,210 **** return element; } ! /** * @see PersistentCollection#entries() --- 206,210 ---- return element; } ! /** * @see PersistentCollection#entries() *************** *** 220,224 **** } } ! /** a wrapper for Map.Entry sets */ class EntrySetProxy implements java.util.Set { --- 220,224 ---- } } ! /** a wrapper for Map.Entry sets */ class EntrySetProxy implements java.util.Set { *************** *** 307,313 **** } } ! public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { java.util.Map old = map; --- 307,313 ---- } } ! public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { java.util.Map old = map; *************** *** 316,325 **** while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! map.put( ! persister.getIndexType().assemble( (Serializable) e.getKey(), session, null), ! persister.getElementType().assemble( (Serializable) e.getValue(), session, null ) ); } ! } --- 316,325 ---- while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! map.put( ! persister.getIndexType().assemble( (Serializable) e.getKey(), session, null), ! persister.getElementType().assemble( (Serializable) e.getValue(), session, null ) ); } ! } *************** *** 330,342 **** while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! result.put( ! persister.getIndexType().disassemble( e.getKey(), session ), ! persister.getElementType().disassemble( e.getValue(), session ) ); } return result; ! } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); --- 330,342 ---- while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! result.put( ! persister.getIndexType().disassemble( e.getKey(), session ), ! persister.getElementType().disassemble( e.getValue(), session ) ); } return result; ! } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); *************** *** 349,353 **** return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { final java.util.Map sn = (java.util.Map) getSnapshot(); --- 349,353 ---- return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { final java.util.Map sn = (java.util.Map) getSnapshot(); *************** *** 355,359 **** return !sn.containsKey( e.getKey() ); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { final java.util.Map sn = (java.util.Map) getSnapshot(); --- 355,359 ---- return !sn.containsKey( e.getKey() ); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { final java.util.Map sn = (java.util.Map) getSnapshot(); *************** *** 361,366 **** return sn.containsKey( e.getKey() ) && !elemType.equals( e.getValue(), sn.get( e.getKey() ) ); } ! ! public Object getIndex(Object entry, int i) { return ( (java.util.Map.Entry) entry ).getKey(); --- 361,366 ---- return sn.containsKey( e.getKey() ) && !elemType.equals( e.getValue(), sn.get( e.getKey() ) ); } ! ! public Object getIndex(Object entry, int i) { return ( (java.util.Map.Entry) entry ).getKey(); *************** *** 368,372 **** public Map() {} ! public boolean equals(Object other) { read(); --- 368,372 ---- public Map() {} ! public boolean equals(Object other) { read(); *************** *** 378,382 **** return map.hashCode(); } ! } --- 378,385 ---- return map.hashCode(); } ! } + + + Index: ODMGCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ODMGCollection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ODMGCollection.java 3 Jan 2003 14:07:30 -0000 1.2 --- ODMGCollection.java 4 Jan 2003 11:15:27 -0000 1.3 *************** *** 12,18 **** public abstract class ODMGCollection ! extends PersistentCollection ! implements DCollection { ! /** * Constructor for ODMGCollection. --- 12,18 ---- public abstract class ODMGCollection ! extends PersistentCollection ! implements DCollection { ! /** * Constructor for ODMGCollection. *************** *** 22,26 **** super(session); } ! /** * Constructor for ODMGCollection. --- 22,26 ---- super(session); } ! /** * Constructor for ODMGCo... [truncated message content] |
From: <one...@us...> - 2003-01-04 11:16:00
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/cache Modified Files: Cache.java CacheConcurrencyStrategy.java CacheException.java CacheTest.java CachedItem.java HashBelt.java JCSCache.java ReadOnlyCache.java ReadWriteCache.java Timestamper.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: Cache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/Cache.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Cache.java 1 Jan 2003 13:53:52 -0000 1.1.1.1 --- Cache.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 34,35 **** --- 34,38 ---- public void setClass(String clazz) throws CacheException; } + + + Index: CacheConcurrencyStrategy.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/CacheConcurrencyStrategy.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CacheConcurrencyStrategy.java 1 Jan 2003 13:53:52 -0000 1.1.1.1 --- CacheConcurrencyStrategy.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 7,11 **** */ public interface CacheConcurrencyStrategy { ! /** * Attempt to retrieve an object from the cache --- 7,11 ---- */ public interface CacheConcurrencyStrategy { ! /** * Attempt to retrieve an object from the cache *************** *** 38,41 **** */ public void release(Object key) throws CacheException; ! } --- 38,44 ---- */ public void release(Object key) throws CacheException; ! } + + + Index: CacheException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/CacheException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CacheException.java 1 Jan 2003 13:53:52 -0000 1.1.1.1 --- CacheException.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 8,19 **** */ public class CacheException extends HibernateException { ! public CacheException(String s) { super(s); } ! public CacheException(Exception e) { super(e); } ! } --- 8,22 ---- */ public class CacheException extends HibernateException { ! public CacheException(String s) { super(s); } ! public CacheException(Exception e) { super(e); } ! } + + + Index: CacheTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/CacheTest.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CacheTest.java 1 Jan 2003 13:53:53 -0000 1.1.1.1 --- CacheTest.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 5,9 **** public class CacheTest extends TestCase { ! public CacheTest(String arg0) { super(arg0); --- 5,9 ---- public class CacheTest extends TestCase { ! public CacheTest(String arg0) { super(arg0); *************** *** 124,128 **** assertTrue( ccs.get("foo", longLongAfter).equals("baz") ); ! if ( cache instanceof HashBelt ) { --- 124,128 ---- assertTrue( ccs.get("foo", longLongAfter).equals("baz") ); ! if ( cache instanceof HashBelt ) { *************** *** 132,135 **** } ! } --- 132,138 ---- } ! } + + + Index: CachedItem.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/CachedItem.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CachedItem.java 1 Jan 2003 13:53:52 -0000 1.1.1.1 --- CachedItem.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 16,20 **** private int lock; private Object value; ! public CachedItem(Object value) { this.value = value; --- 16,20 ---- private int lock; private Object value; ! public CachedItem(Object value) { this.value = value; *************** *** 31,35 **** return unlockTimestamp; } ! public Object getValue() { return value; --- 31,35 ---- return unlockTimestamp; } ! public Object getValue() { return value; *************** *** 54,57 **** return lock==0; } ! } --- 54,60 ---- return lock==0; } ! } + + + Index: HashBelt.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/HashBelt.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HashBelt.java 1 Jan 2003 13:53:53 -0000 1.1.1.1 --- HashBelt.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 2,6 **** package net.sf.hibernate.cache; ! /** * Adaptation of design by William Grosso from onjava.com. * This implementation does not use a seperate thread to --- 2,6 ---- package net.sf.hibernate.cache; ! /** * Adaptation of design by William Grosso from onjava.com. * This implementation does not use a seperate thread to *************** *** 8,12 **** * the hashbelt design, but not all.<br> * <br> ! * This class is non-threadsafe so it <b>must</b> be wrapped * by a threadsafe version before you can use it. */ --- 8,12 ---- * the hashbelt design, but not all.<br> * <br> ! * This class is non-threadsafe so it <b>must</b> be wrapped * by a threadsafe version before you can use it. */ *************** *** 28,34 **** lastTime = System.currentTimeMillis(); } ! public Object get(Object key) { ! expire(); //TODO: expire should be outside synchronized block if // we need to explicitly expire data --- 28,34 ---- lastTime = System.currentTimeMillis(); } ! public Object get(Object key) { ! expire(); //TODO: expire should be outside synchronized block if // we need to explicitly expire data *************** *** 40,44 **** return null; } ! public Object invalidate(Object key) { expire(); --- 40,44 ---- return null; } ! public Object invalidate(Object key) { expire(); *************** *** 49,58 **** return null; } ! public void put(Object key, Object value) { invalidate(key); batches[0].put(key, value); } ! public void setTimeout(int timeout) { this.timeout=timeout; --- 49,58 ---- return null; } ! public void put(Object key, Object value) { invalidate(key); batches[0].put(key, value); } ! public void setTimeout(int timeout) { this.timeout=timeout; *************** *** 79,82 **** } } ! } --- 79,85 ---- } } ! } + + + Index: JCSCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/JCSCache.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** JCSCache.java 1 Jan 2003 13:53:53 -0000 1.1.1.1 --- JCSCache.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 10,22 **** */ public class JCSCache implements Cache { ! ! private static final Log log = LogFactory.getLog(JCSCache.class); ! ! private JCS region; ! ! public JCSCache() {} ! ! public void setClass(String clazz) throws CacheException { ! try { region = JCS.getInstance(clazz); --- 10,22 ---- */ public class JCSCache implements Cache { ! ! private static final Log log = LogFactory.getLog(JCSCache.class); ! ! private JCS region; ! ! public JCSCache() {} ! ! public void setClass(String clazz) throws CacheException { ! try { region = JCS.getInstance(clazz); *************** *** 27,35 **** } } ! ! public Object get(Object key) { ! return region.get(key); ! } ! public void put(Object key, Object value) throws CacheException { try { --- 27,35 ---- } } ! ! public Object get(Object key) { ! return region.get(key); ! } ! public void put(Object key, Object value) throws CacheException { try { *************** *** 40,45 **** throw new CacheException(e); } ! } ! ! public void setTimeout(int timeout) { } } --- 40,48 ---- throw new CacheException(e); } ! } ! ! public void setTimeout(int timeout) { } } + + + Index: ReadOnlyCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/ReadOnlyCache.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ReadOnlyCache.java 1 Jan 2003 13:53:53 -0000 1.1.1.1 --- ReadOnlyCache.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 10,21 **** */ public class ReadOnlyCache implements CacheConcurrencyStrategy { ! private final Cache cache; private static final Log log = LogFactory.getLog(ReadOnlyCache.class); ! public ReadOnlyCache(Cache cache) { this.cache=cache; } ! public synchronized Object get(Object key, long timestamp) throws CacheException { Object result = cache.get(key); --- 10,21 ---- */ public class ReadOnlyCache implements CacheConcurrencyStrategy { ! private final Cache cache; private static final Log log = LogFactory.getLog(ReadOnlyCache.class); ! public ReadOnlyCache(Cache cache) { this.cache=cache; } ! public synchronized Object get(Object key, long timestamp) throws CacheException { Object result = cache.get(key); *************** *** 23,32 **** return result; } ! public void lock(Object key) { log.error("Application attempted to edit read only item: " + key); throw new UnsupportedOperationException("Can't write to a readonly object"); } ! public synchronized boolean put(Object key, Object value, long timestamp) throws CacheException { log.debug("Caching: " + key); --- 23,32 ---- return result; } ! public void lock(Object key) { log.error("Application attempted to edit read only item: " + key); throw new UnsupportedOperationException("Can't write to a readonly object"); } ! public synchronized boolean put(Object key, Object value, long timestamp) throws CacheException { log.debug("Caching: " + key); *************** *** 34,42 **** return true; } ! public void release(Object key) { log.error("Application attempted to edit read only item: " + key); throw new UnsupportedOperationException("Can't write to a readonly object"); } ! } --- 34,45 ---- return true; } ! public void release(Object key) { log.error("Application attempted to edit read only item: " + key); throw new UnsupportedOperationException("Can't write to a readonly object"); } ! } + + + Index: ReadWriteCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/ReadWriteCache.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ReadWriteCache.java 1 Jan 2003 13:53:53 -0000 1.1.1.1 --- ReadWriteCache.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 19,23 **** this.cache=cache; } ! public synchronized Object get(Object key, long txTimestamp) throws CacheException { --- 19,23 ---- this.cache=cache; } ! public synchronized Object get(Object key, long txTimestamp) throws CacheException { *************** *** 26,39 **** CachedItem item = (CachedItem) cache.get(key); ! if ( ! item!=null && ! item.getFreshTimestamp() < txTimestamp && item.isFresh() // || txTimestamp < item.getLockTimestamp() ) { ! if ( log.isTraceEnabled() ) log.trace("Cache hit: " + key); return item.getValue(); } else { ! if ( log.isTraceEnabled() ) log.trace("Cache miss: " + key); return null; } --- 26,39 ---- CachedItem item = (CachedItem) cache.get(key); ! if ( ! item!=null && ! item.getFreshTimestamp() < txTimestamp && item.isFresh() // || txTimestamp < item.getLockTimestamp() ) { ! if ( log.isTraceEnabled() ) log.trace("Cache hit: " + key); return item.getValue(); } else { ! if ( log.isTraceEnabled() ) log.trace("Cache miss: " + key); return null; } *************** *** 42,46 **** //TODO: Actually keep locked CachedItems in a different HashMap //in this class until they are unlocked ! public synchronized void lock(Object key) throws CacheException { if ( log.isTraceEnabled() ) log.trace("Invalidating: " + key); --- 42,46 ---- //TODO: Actually keep locked CachedItems in a different HashMap //in this class until they are unlocked ! public synchronized void lock(Object key) throws CacheException { if ( log.isTraceEnabled() ) log.trace("Invalidating: " + key); *************** *** 52,56 **** } ! public synchronized boolean put(Object key, Object value, long txTimestamp) throws CacheException { if ( log.isTraceEnabled() ) log.trace("Caching: " + key); --- 52,56 ---- } ! public synchronized boolean put(Object key, Object value, long txTimestamp) throws CacheException { if ( log.isTraceEnabled() ) log.trace("Caching: " + key); *************** *** 58,64 **** CachedItem item = (CachedItem) cache.get(key); ! if ( item==null || ! ( item.isUnlocked() && !item.isFresh() && item.getUnlockTimestamp() < txTimestamp ) ) { cache.put( key, new CachedItem(value) ); --- 58,64 ---- CachedItem item = (CachedItem) cache.get(key); ! if ( item==null || ! ( item.isUnlocked() && !item.isFresh() && item.getUnlockTimestamp() < txTimestamp ) ) { cache.put( key, new CachedItem(value) ); *************** *** 86,89 **** } ! } --- 86,92 ---- } ! } + + + Index: Timestamper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/Timestamper.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Timestamper.java 1 Jan 2003 13:53:54 -0000 1.1.1.1 --- Timestamper.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 25,26 **** --- 25,29 ---- } } + + + |
From: <one...@us...> - 2003-01-04 11:16:00
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/cfg Modified Files: Configuration.java Datastore.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: Configuration.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg/Configuration.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Configuration.java 1 Jan 2003 13:53:55 -0000 1.1.1.1 --- Configuration.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 17,21 **** * <pre> * <?xml version='1.0' encoding='utf-8'?> ! * <!DOCTYPE hibernate-configuration PUBLIC * "-//Hibernate/Hibernate Configuration DTD//EN" * "http://hibernate.sourceforge.net/hibernate-configuration.dtd"> --- 17,21 ---- * <pre> * <?xml version='1.0' encoding='utf-8'?> ! * <!DOCTYPE hibernate-configuration PUBLIC * "-//Hibernate/Hibernate Configuration DTD//EN" * "http://hibernate.sourceforge.net/hibernate-configuration.dtd"> *************** *** 58,62 **** private Log log = LogFactory.getLog(Configuration.class); ! private String resource; --- 58,62 ---- private Log log = LogFactory.getLog(Configuration.class); ! private String resource; *************** *** 66,70 **** protected Configuration() { } ! public Configuration(String resource) { this.resource = resource; --- 66,70 ---- protected Configuration() { } ! public Configuration(String resource) { this.resource = resource; *************** *** 77,81 **** */ protected InputStream getConfigurationInputStream() throws HibernateException { ! log.info("Configuration resource: " + resource); --- 77,81 ---- */ protected InputStream getConfigurationInputStream() throws HibernateException { ! log.info("Configuration resource: " + resource); *************** *** 86,92 **** } return stream; ! } ! private void addProperties(Node parent, Properties properties) { NodeList children = parent.getChildNodes(); --- 86,92 ---- } return stream; ! } ! private void addProperties(Node parent, Properties properties) { NodeList children = parent.getChildNodes(); *************** *** 103,107 **** Environment.verifyProperties(properties); }; ! public SessionFactory[] configure() throws HibernateException { --- 103,107 ---- Environment.verifyProperties(properties); }; ! public SessionFactory[] configure() throws HibernateException { *************** *** 109,113 **** InputStream stream = getConfigurationInputStream(); ! Document doc; try { --- 109,113 ---- InputStream stream = getConfigurationInputStream(); ! Document doc; try { *************** *** 121,125 **** topLevelProps.putAll( Environment.getProperties() ); addProperties( doc.getDocumentElement(), topLevelProps ); ! NodeList sfElements = doc.getDocumentElement().getElementsByTagName("session-factory"); for ( int i=0; i<sfElements.getLength(); i++ ) { --- 121,125 ---- topLevelProps.putAll( Environment.getProperties() ); addProperties( doc.getDocumentElement(), topLevelProps ); ! NodeList sfElements = doc.getDocumentElement().getElementsByTagName("session-factory"); for ( int i=0; i<sfElements.getLength(); i++ ) { *************** *** 131,135 **** Datastore ds = Hibernate.createDatastore(); ! NodeList mapElements = sfNode.getChildNodes(); for ( int j=0; j<mapElements.getLength(); j++ ) { --- 131,135 ---- Datastore ds = Hibernate.createDatastore(); ! NodeList mapElements = sfNode.getChildNodes(); for ( int j=0; j<mapElements.getLength(); j++ ) { *************** *** 153,157 **** ds.storeJar( jar.getNodeValue() ); } ! else { if (file==null) throw new HibernateException("<mapping> element in configuration specifies no attributes"); log.debug(name + "<-" + file); --- 153,157 ---- ds.storeJar( jar.getNodeValue() ); } ! else { if (file==null) throw new HibernateException("<mapping> element in configuration specifies no attributes"); log.debug(name + "<-" + file); *************** *** 160,164 **** } } ! factories.add( ds.buildSessionFactory(props) ); --- 160,164 ---- } } ! factories.add( ds.buildSessionFactory(props) ); *************** *** 172,173 **** --- 172,176 ---- } } + + + Index: Datastore.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg/Datastore.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Datastore.java 1 Jan 2003 13:53:55 -0000 1.1.1.1 --- Datastore.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 14,163 **** import net.sf.hibernate.tool.hbm2ddl.JdbcDatabaseInfo; ! /** ! An instance of <tt>Datastore</tt> represents an entire mapping from a set of ! Java classes to a relational model. Usually an application will configure a ! single instance of <tt>Datastore</tt>, obtain a single instance of ! <tt>SessionFactory</tt> and then instantiate <tt>Session</tt>s in ! threads servicing client requests. The <tt>Datastore</tt> is meant as a ! configuration-time object.<br> ! <br> ! New instances are provided by the factory method ! <tt>Hibernate.createDatastore()</tt><br> ! <br> ! It is not intended that implementors be threadsafe. ! ! @see SessionFactory ! @see Hibernate#createDatastore() */ public interface Datastore { /** ! Obtain a factory for <tt>Session</tt>s. Connections may be provided by the application ! or according to System properties. ! ! @return SessionFactory ! @throws HibernateException */ public SessionFactory buildSessionFactory() throws HibernateException; ! /** ! Obtain a factory for <tt>Session</tt>s. Connections may be provided by the application ! or according to the given <tt>Properties</tt>. ! ! @param connectionProps connection properties ! @return SessionFactory ! @throws HibernateException */ public SessionFactory buildSessionFactory(Properties connectionProps) ! throws HibernateException; ! /** ! Obtain a factory for <tt>Session</tt>s, specifying an <tt>Interceptor</tt>. Connections ! may be provided by the application or according to System properties. ! ! @return SessionFactory ! @param interceptor a factory-scoped interceptor ! @throws HibernateException */ public SessionFactory buildSessionFactory(Interceptor interceptor) throws HibernateException; ! /** ! Obtain a factory for <tt>Session</tt>s, specifying an <tt>Interceptor</tt>. Connections ! may be provided by the application or according to the given <tt>Properties</tt>. ! ! @param connectionProps connection properties ! @param interceptor intercepts important session events ! @return SessionFactory ! @throws HibernateException */ public SessionFactory buildSessionFactory(Properties connectionProps, Interceptor interceptor) ! throws HibernateException; ! /** ! Load persistence mappings from an XML file. ! ! @param xmlFile the filename ! @return Datastore ! @throws MappingException */ public Datastore storeFile(String xmlFile) throws MappingException; ! /** ! Load persistence mappings from an XML file, using <tt>getResourceAsStream()</tt>. ! ! @param path the resource path ! @param classLoader the <tt>ClassLoader</tt> to use ! @return Datastore ! @throws MappingException */ public Datastore storeResource(String path, ClassLoader classLoader) ! throws MappingException; /** ! Load persistence mappings from an input stream containing XML. ! ! @param xmlInputStream an input stream containing XML data ! @return Datastore ! @throws MappingException */ public Datastore storeInputStream(InputStream xmlInputStream) ! throws MappingException; ! /** ! Load persistence mappings from a string containing XML. ! ! @param xml ! @return Datastore ! @throws MappingException */ public Datastore storeXML(String xml) throws MappingException; ! /** ! Load persistence mappings from a parsed XML document. ! ! @param doc ! @return Datastore ! @throws MappingException */ public Datastore storeDocument(Document doc) throws MappingException; ! ! /** ! Look for a mapping file for the given class using a naming convention. ! <tt>storeClass(eg.Foo.class)</tt> looks for <tt>eg/Foo.hbm.xml</tt> in ! the classpath. ! ! @param persistentClass the mapped persistent class ! @return Datastore ! @throws MappingException */ public Datastore storeClass(Class persistentClass) throws MappingException; ! /** ! Look for mapping files in a jar. Any files with names ending in <tt>.hbm.xml</tt> ! will be assumed to be mapping documents. ! ! @param resource the <tt>.jar</tt> file ! @return Datastore ! @throws MappingException */ public Datastore storeJar(String resource) throws MappingException; ! /** ! Generates a list of SQL statements that may be used to create the tables ! needed by this <tt>Datastore</tt>. ! ! @param dialect the script SQL dialect */ public String[] generateSchemaCreationScript(Dialect dialect) ! throws HibernateException; ! /** ! Generates a list of SQL statements that may be used to drop the tables ! needed by this <tt>Datastore</tt>. ! ! @param dialect the script SQL dialect */ public String[] generateDropSchemaScript(Dialect dialect) ! throws HibernateException; ! ! public String[] generateSchemaUpdateScript(Dialect dialect, JdbcDatabaseInfo info) throws HibernateException; } --- 14,166 ---- import net.sf.hibernate.tool.hbm2ddl.JdbcDatabaseInfo; ! /** ! An instance of <tt>Datastore</tt> represents an entire mapping from a set of ! Java classes to a relational model. Usually an application will configure a ! single instance of <tt>Datastore</tt>, obtain a single instance of ! <tt>SessionFactory</tt> and then instantiate <tt>Session</tt>s in ! threads servicing client requests. The <tt>Datastore</tt> is meant as a ! configuration-time object.<br> ! <br> ! New instances are provided by the factory method ! <tt>Hibernate.createDatastore()</tt><br> ! <br> ! It is not intended that implementors be threadsafe. ! ! @see SessionFactory ! @see Hibernate#createDatastore() */ public interface Datastore { /** ! Obtain a factory for <tt>Session</tt>s. Connections may be provided by the application ! or according to System properties. ! ! @return SessionFactory ! @throws HibernateException */ public SessionFactory buildSessionFactory() throws HibernateException; ! /** ! Obtain a factory for <tt>Session</tt>s. Connections may be provided by the application ! or according to the given <tt>Properties</tt>. ! ! @param connectionProps connection properties ! @return SessionFactory ! @throws HibernateException */ public SessionFactory buildSessionFactory(Properties connectionProps) ! throws HibernateException; ! /** ! Obtain a factory for <tt>Session</tt>s, specifying an <tt>Interceptor</tt>. Connections ! may be provided by the application or according to System properties. ! ! @return SessionFactory ! @param interceptor a factory-scoped interceptor ! @throws HibernateException */ public SessionFactory buildSessionFactory(Interceptor interceptor) throws HibernateException; ! /** ! Obtain a factory for <tt>Session</tt>s, specifying an <tt>Interceptor</tt>. Connections ! may be provided by the application or according to the given <tt>Properties</tt>. ! ! @param connectionProps connection properties ! @param interceptor intercepts important session events ! @return SessionFactory ! @throws HibernateException */ public SessionFactory buildSessionFactory(Properties connectionProps, Interceptor interceptor) ! throws HibernateException; ! /** ! Load persistence mappings from an XML file. ! ! @param xmlFile the filename ! @return Datastore ! @throws MappingException */ public Datastore storeFile(String xmlFile) throws MappingException; ! /** ! Load persistence mappings from an XML file, using <tt>getResourceAsStream()</tt>. ! ! @param path the resource path ! @param classLoader the <tt>ClassLoader</tt> to use ! @return Datastore ! @throws MappingException */ public Datastore storeResource(String path, ClassLoader classLoader) ! throws MappingException; /** ! Load persistence mappings from an input stream containing XML. ! ! @param xmlInputStream an input stream containing XML data ! @return Datastore ! @throws MappingException */ public Datastore storeInputStream(InputStream xmlInputStream) ! throws MappingException; ! /** ! Load persistence mappings from a string containing XML. ! ! @param xml ! @return Datastore ! @throws MappingException */ public Datastore storeXML(String xml) throws MappingException; ! /** ! Load persistence mappings from a parsed XML document. ! ! @param doc ! @return Datastore ! @throws MappingException */ public Datastore storeDocument(Document doc) throws MappingException; ! ! /** ! Look for a mapping file for the given class using a naming convention. ! <tt>storeClass(eg.Foo.class)</tt> looks for <tt>eg/Foo.hbm.xml</tt> in ! the classpath. ! ! @param persistentClass the mapped persistent class ! @return Datastore ! @throws MappingException */ public Datastore storeClass(Class persistentClass) throws MappingException; ! /** ! Look for mapping files in a jar. Any files with names ending in <tt>.hbm.xml</tt> ! will be assumed to be mapping documents. ! ! @param resource the <tt>.jar</tt> file ! @return Datastore ! @throws MappingException */ public Datastore storeJar(String resource) throws MappingException; ! /** ! Generates a list of SQL statements that may be used to create the tables ! needed by this <tt>Datastore</tt>. ! ! @param dialect the script SQL dialect */ public String[] generateSchemaCreationScript(Dialect dialect) ! throws HibernateException; ! /** ! Generates a list of SQL statements that may be used to drop the tables ! needed by this <tt>Datastore</tt>. ! ! @param dialect the script SQL dialect */ public String[] generateDropSchemaScript(Dialect dialect) ! throws HibernateException; ! ! public String[] generateSchemaUpdateScript(Dialect dialect, JdbcDatabaseInfo info) throws HibernateException; } + + + |
From: <one...@us...> - 2003-01-04 11:15:59
|
Update of /cvsroot/hibernate/Hibernate2/src In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src Modified Files: hibernate.properties Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: hibernate.properties =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/hibernate.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hibernate.properties 3 Jan 2003 22:47:23 -0000 1.2 --- hibernate.properties 4 Jan 2003 11:15:27 -0000 1.3 *************** *** 26,44 **** ## PostgreSQL ! hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect ! hibernate.connection.driver_class org.postgresql.Driver ! hibernate.connection.url jdbc:postgresql:template1 ! hibernate.connection.username pg ! hibernate.connection.password ! hibernate.query.substitutions yes 'Y', no 'N' ## DB2 ! #hibernate.dialect net.sf.hibernate.dialect.DB2Dialect ! #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver ! #hibernate.connection.url jdbc:db2:test ! #hibernate.connection.username db2 ! #hibernate.connection.password db2 --- 26,44 ---- ## PostgreSQL ! #hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect ! #hibernate.connection.driver_class org.postgresql.Driver ! #hibernate.connection.url jdbc:postgresql:template1 ! #hibernate.connection.username pg ! #hibernate.connection.password ! #hibernate.query.substitutions yes 'Y', no 'N' ## DB2 ! hibernate.dialect net.sf.hibernate.dialect.DB2Dialect ! hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver ! hibernate.connection.url jdbc:db2:test ! hibernate.connection.username db2 ! hibernate.connection.password db2 |
From: <one...@us...> - 2003-01-04 11:15:40
|
Update of /cvsroot/hibernate/Hibernate2 In directory sc8-pr-cvs1:/tmp/cvs-serv14211 Added Files: indent.py Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception --- NEW FILE: indent.py --- import re import sys sys.argv.pop(0) for fname in sys.argv: file = open(fname) inlines = file.read().split('\n') file.close() out= [] tabcount = 0 for ln in inlines: code = ln.lstrip('\t ').rstrip('\t ') clen = len(code) if clen > 0 and code[0]=='*': code = ' ' + code begincb = clen > 0 and ( code[0]=='}' or code[0]==')' ) tabcount -= begincb tabs = '\t' * tabcount if clen>5 and code[0:6] == '} else': code = '}\n' + tabs + 'else' + code[6:] if clen>6 and code[0:7] == '} catch': code = '}\n' + tabs + 'catch' + code[7:] out.append( tabs + code + '\n' ) uncommented = code.split('//')[0].rstrip() clen = len(uncommented) endob = clen > 0 and ( code[clen-1]=='{' or code[clen-1]=='(' ) tabcount += endob file = open( fname, 'w' ) for ln in out: file.write(ln) file.close() |
From: <one...@us...> - 2003-01-03 22:47:33
|
Update of /cvsroot/hibernate/Hibernate2/src In directory sc8-pr-cvs1:/tmp/cvs-serv27930/src Modified Files: hibernate.properties log4j.properties Log Message: added some logging to JDBC pools Index: hibernate.properties =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/hibernate.properties,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** hibernate.properties 1 Jan 2003 13:53:40 -0000 1.1.1.1 --- hibernate.properties 3 Jan 2003 22:47:23 -0000 1.2 *************** *** 26,44 **** ## PostgreSQL ! #hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect ! #hibernate.connection.driver_class org.postgresql.Driver ! #hibernate.connection.url jdbc:postgresql:template1 ! #hibernate.connection.username pg ! #hibernate.connection.password ! #hibernate.query.substitutions yes 'Y', no 'N' ## DB2 ! hibernate.dialect net.sf.hibernate.dialect.DB2Dialect ! hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver ! hibernate.connection.url jdbc:db2:test ! hibernate.connection.username db2 ! hibernate.connection.password db2 --- 26,44 ---- ## PostgreSQL ! hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect ! hibernate.connection.driver_class org.postgresql.Driver ! hibernate.connection.url jdbc:postgresql:template1 ! hibernate.connection.username pg ! hibernate.connection.password ! hibernate.query.substitutions yes 'Y', no 'N' ## DB2 ! #hibernate.dialect net.sf.hibernate.dialect.DB2Dialect ! #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver ! #hibernate.connection.url jdbc:db2:test ! #hibernate.connection.username db2 ! #hibernate.connection.password db2 Index: log4j.properties =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/log4j.properties,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** log4j.properties 1 Jan 2003 13:53:40 -0000 1.1.1.1 --- log4j.properties 3 Jan 2003 22:47:23 -0000 1.2 *************** *** 17,23 **** log4j.logger.net.sf.hibernate=info ! # log JDBC bind parameters log4j.logger.net.sf.hibernate.type=info ! # log prepared statement cache activity log4j.logger.net.sf.hibernate.ps.PreparedStatementCache=info --- 17,27 ---- log4j.logger.net.sf.hibernate=info ! ### enable the following line if you want to track down connection ### ! ### leakages when using DriverManagerConnectionProvider ### ! #log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=trace ! ! ### log JDBC bind parameters ### log4j.logger.net.sf.hibernate.type=info ! ### log prepared statement cache activity ### log4j.logger.net.sf.hibernate.ps.PreparedStatementCache=info |
From: <one...@us...> - 2003-01-03 22:47:33
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/ps In directory sc8-pr-cvs1:/tmp/cvs-serv27930/src/net/sf/hibernate/ps Modified Files: PreparedStatementCache.java Log Message: added some logging to JDBC pools Index: PreparedStatementCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/ps/PreparedStatementCache.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PreparedStatementCache.java 1 Jan 2003 13:56:43 -0000 1.1.1.1 --- PreparedStatementCache.java 3 Jan 2003 22:47:24 -0000 1.2 *************** *** 65,69 **** if (ps==null) { ! if ( log.isTraceEnabled() ) log.trace("Preparing statement: " + sql); try { ps = scrollable ? --- 65,69 ---- if (ps==null) { ! if ( log.isTraceEnabled() ) log.trace("preparing statement: " + sql); try { ps = scrollable ? *************** *** 81,85 **** } else { ! if ( log.isTraceEnabled() ) log.trace("Returning cached statement: " + sql); } --- 81,85 ---- } else { ! if ( log.isTraceEnabled() ) log.trace("returning cached statement: " + sql); } *************** *** 124,129 **** if ( log.isTraceEnabled() ) { synchronized(this) { ! log.trace( "Total checked-out statements: " + ( entryMap.size() - entries.size() ) ); ! log.trace( "Checked out: " + open ); } } --- 124,129 ---- if ( log.isTraceEnabled() ) { synchronized(this) { ! log.trace( "total checked-out statements: " + ( entryMap.size() - entries.size() ) ); ! log.trace( "checked out: " + open ); } } |
From: <one...@us...> - 2003-01-03 22:47:33
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection In directory sc8-pr-cvs1:/tmp/cvs-serv27930/src/net/sf/hibernate/connection Modified Files: DriverManagerConnectionProvider.java Log Message: added some logging to JDBC pools Index: DriverManagerConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/DriverManagerConnectionProvider.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DriverManagerConnectionProvider.java 1 Jan 2003 13:54:10 -0000 1.1.1.1 --- DriverManagerConnectionProvider.java 3 Jan 2003 22:47:24 -0000 1.2 *************** *** 2,17 **** package net.sf.hibernate.connection; ! import java.sql.*; import java.util.Iterator; import java.util.Properties; - import java.util.Stack; - - import org.apache.commons.logging.Log; - import org.apache.commons.logging.LogFactory; ! import net.sf.hibernate.*; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.PropertiesHelper; /** * A connection provider that uses <tt>java.sql.DriverManager</tt>. This provider --- 2,20 ---- package net.sf.hibernate.connection; ! import java.sql.Connection; ! import java.sql.DriverManager; ! import java.sql.SQLException; ! import java.util.ArrayList; import java.util.Iterator; import java.util.Properties; ! import net.sf.hibernate.Environment; ! import net.sf.hibernate.HibernateException; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.PropertiesHelper; + import org.apache.commons.logging.Log; + import org.apache.commons.logging.LogFactory; + /** * A connection provider that uses <tt>java.sql.DriverManager</tt>. This provider *************** *** 24,29 **** private Properties connectionProps; private Integer isolation; ! private final Stack cache = new Stack(); private int poolSize; private static final Log log = LogFactory.getLog(DriverManagerConnectionProvider.class); --- 27,33 ---- private Properties connectionProps; private Integer isolation; ! private final ArrayList pool = new ArrayList(); private int poolSize; + private int checkedOut = 0; private static final Log log = LogFactory.getLog(DriverManagerConnectionProvider.class); *************** *** 35,39 **** poolSize = PropertiesHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20 log.info("Hibernate connection pool size: " + poolSize); ! isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props); if (isolation!=null) --- 39,43 ---- poolSize = PropertiesHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20 log.info("Hibernate connection pool size: " + poolSize); ! isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props); if (isolation!=null) *************** *** 41,45 **** if (driverClass==null) { ! log.warn("No JDBC Driver class was specified by property " + Environment.DRIVER); } else { --- 45,49 ---- if (driverClass==null) { ! log.warn("no JDBC Driver class was specified by property " + Environment.DRIVER); } else { *************** *** 63,80 **** connectionProps = ConnectionProviderFactory.getJdbcConnectionProperties(props); ! log.info( "Using driver: " + driverClass + " at URL: " + url ); ! log.info("Connection properties: " + connectionProps); } public Connection getConnection() throws SQLException { ! synchronized (cache) { ! if ( !cache.isEmpty() ) { ! log.trace("Using cached JDBC connection"); ! return (Connection) cache.pop(); } } ! log.debug("Opening new JDBC connection"); Connection conn; try { --- 67,91 ---- connectionProps = ConnectionProviderFactory.getJdbcConnectionProperties(props); ! log.info( "using driver: " + driverClass + " at URL: " + url ); ! log.info("connection properties: " + connectionProps); } public Connection getConnection() throws SQLException { ! ! if ( log.isTraceEnabled() ) log.trace( "total checked-out connections: " + checkedOut ); ! ! synchronized (pool) { ! if ( !pool.isEmpty() ) { ! int last = pool.size() - 1; ! if ( log.isTraceEnabled() ) { ! log.trace("using pooled JDBC connection, pool size: " + last); ! checkedOut++; ! } ! return (Connection) pool.remove(last); } } ! log.debug("opening new JDBC connection"); Connection conn; try { *************** *** 87,91 **** throw sqle; } ! if ( log.isDebugEnabled() ) log.debug( "Created connection to: " + url + ", Isolation Level: " + conn.getTransactionIsolation() ); return conn; } --- 98,107 ---- throw sqle; } ! ! if ( log.isDebugEnabled() ) { ! log.debug( "created connection to: " + url + ", Isolation Level: " + conn.getTransactionIsolation() ); ! } ! if ( log.isTraceEnabled() ) checkedOut++; ! return conn; } *************** *** 93,105 **** public void closeConnection(Connection conn) throws SQLException { ! synchronized (cache) { ! if ( cache.size() < poolSize ) { ! log.trace("returning connection to pool"); ! cache.push(conn); return; } } ! log.debug("Closing JDBC connection"); try { --- 109,124 ---- public void closeConnection(Connection conn) throws SQLException { ! if ( log.isDebugEnabled() ) checkedOut--; ! ! synchronized (pool) { ! int currentSize = pool.size(); ! if ( currentSize < poolSize ) { ! if ( log.isTraceEnabled() ) log.trace("returning connection to pool, pool size: " + (currentSize + 1) ); ! pool.add(conn); return; } } ! log.debug("closing JDBC connection"); try { *************** *** 118,124 **** protected void finalize() { ! log.info("Cleaning up dereferenced connection pool: " + url); ! Iterator iter = cache.iterator(); while ( iter.hasNext() ) { try { --- 137,143 ---- protected void finalize() { ! log.info("cleaning up dereferenced connection pool: " + url); ! Iterator iter = pool.iterator(); while ( iter.hasNext() ) { try { |
From: <one...@us...> - 2003-01-03 14:07:33
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv16060/src/net/sf/hibernate/collection Modified Files: Bag.java List.java Map.java ODMGCollection.java Set.java Log Message: collections (except bag) now implement equals(), hashCode() as specified by their collections framework contracts Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Bag.java 3 Jan 2003 13:36:00 -0000 1.2 --- Bag.java 3 Jan 2003 14:07:30 -0000 1.3 *************** *** 465,467 **** --- 465,482 ---- } + public String toString() { + read(); + return bag.toString(); + } + + /*public boolean equals(Object other) { + read(); + return bag.equals(other); + } + + public int hashCode(Object other) { + read(); + return bag.hashCode(); + }*/ + } Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** List.java 3 Jan 2003 13:36:00 -0000 1.2 --- List.java 3 Jan 2003 14:07:30 -0000 1.3 *************** *** 392,395 **** --- 392,405 ---- } + public boolean equals(Object other) { + read(); + return list.equals(other); + } + + public int hashCode(Object other) { + read(); + return list.hashCode(); + } + } Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Map.java 3 Jan 2003 13:36:00 -0000 1.2 --- Map.java 3 Jan 2003 14:07:30 -0000 1.3 *************** *** 369,372 **** --- 369,382 ---- public Map() {} + public boolean equals(Object other) { + read(); + return map.equals(other); + } + + public int hashCode(Object other) { + read(); + return map.hashCode(); + } + } Index: ODMGCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ODMGCollection.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ODMGCollection.java 1 Jan 2003 13:54:02 -0000 1.1.1.1 --- ODMGCollection.java 3 Jan 2003 14:07:30 -0000 1.2 *************** *** 11,17 **** import net.sf.hibernate.engine.SessionImplementor; - /** - * - */ public abstract class ODMGCollection extends PersistentCollection --- 11,14 ---- *************** *** 88,91 **** return iter.hasNext() ? iter.next() : null; } ! } --- 85,88 ---- return iter.hasNext() ? iter.next() : null; } ! } Index: Set.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Set.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Set.java 3 Jan 2003 13:36:00 -0000 1.2 --- Set.java 3 Jan 2003 14:07:30 -0000 1.3 *************** *** 388,391 **** --- 388,401 ---- } + public boolean equals(Object other) { + read(); + return set.equals(other); + } + + public int hashCode(Object other) { + read(); + return set.hashCode(); + } + } |
From: <one...@us...> - 2003-01-03 14:07:33
|
Update of /cvsroot/hibernate/Hibernate2 In directory sc8-pr-cvs1:/tmp/cvs-serv16060 Modified Files: changelog.txt Log Message: collections (except bag) now implement equals(), hashCode() as specified by their collections framework contracts Index: changelog.txt =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/changelog.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** changelog.txt 3 Jan 2003 13:35:59 -0000 1.2 --- changelog.txt 3 Jan 2003 14:07:29 -0000 1.3 *************** *** 11,14 **** --- 11,15 ---- * removed exceptions that occur if an object is saved or deleted multiple times in a session * added <parent> subelement to <composite-element> and <nested-composite-element> + * collections except for <bag>s now implement by-value equals() and hashCode() Changes in version 1.2.1b (1.1.2003) |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type In directory sc8-pr-cvs1:/tmp/cvs-serv2643/src/net/sf/hibernate/type Modified Files: ArrayType.java BagType.java BlobType.java CharBooleanType.java ClobType.java ListType.java MapType.java PersistentCollectionType.java PersistentEnumType.java SetType.java SortedMapType.java SortedSetType.java TimeType.java TimestampType.java TypeFactory.java Log Message: removed exceptions that occur if an object is saved or deleted multiple times in a session added <parent> subelement to <composite-element> and <nested-composite-element> Index: ArrayType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ArrayType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ArrayType.java 1 Jan 2003 13:58:02 -0000 1.1.1.1 --- ArrayType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 11,17 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.ArrayHolder; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; public class ArrayType extends PersistentCollectionType { --- 11,17 ---- import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.ArrayHolder; + import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.SessionImplementor; public class ArrayType extends PersistentCollectionType { Index: BagType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BagType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** BagType.java 1 Jan 2003 13:58:03 -0000 1.1.1.1 --- BagType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 4,10 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.Bag; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; public class BagType extends PersistentCollectionType { --- 4,10 ---- import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.Bag; + import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.SessionImplementor; public class BagType extends PersistentCollectionType { Index: BlobType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BlobType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** BlobType.java 1 Jan 2003 13:58:04 -0000 1.1.1.1 --- BlobType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 3,7 **** package net.sf.hibernate.type; ! import java.sql.*; import net.sf.hibernate.HibernateException; --- 3,11 ---- package net.sf.hibernate.type; ! import java.sql.Blob; ! import java.sql.PreparedStatement; ! import java.sql.ResultSet; ! import java.sql.SQLException; ! import java.sql.Types; import net.sf.hibernate.HibernateException; Index: CharBooleanType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/CharBooleanType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CharBooleanType.java 1 Jan 2003 13:58:05 -0000 1.1.1.1 --- CharBooleanType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 2,6 **** package net.sf.hibernate.type; ! import java.sql.*; import net.sf.hibernate.HibernateException; --- 2,9 ---- package net.sf.hibernate.type; ! import java.sql.PreparedStatement; ! import java.sql.ResultSet; ! import java.sql.SQLException; ! import java.sql.Types; import net.sf.hibernate.HibernateException; Index: ClobType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ClobType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ClobType.java 1 Jan 2003 13:58:06 -0000 1.1.1.1 --- ClobType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 3,7 **** package net.sf.hibernate.type; ! import java.sql.*; import net.sf.hibernate.HibernateException; --- 3,11 ---- package net.sf.hibernate.type; ! import java.sql.Clob; ! import java.sql.PreparedStatement; ! import java.sql.ResultSet; ! import java.sql.SQLException; ! import java.sql.Types; import net.sf.hibernate.HibernateException; Index: ListType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ListType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ListType.java 1 Jan 2003 13:58:11 -0000 1.1.1.1 --- ListType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 2,9 **** package net.sf.hibernate.type; import net.sf.hibernate.collection.List; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; public class ListType extends PersistentCollectionType { --- 2,9 ---- package net.sf.hibernate.type; + import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.List; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.SessionImplementor; public class ListType extends PersistentCollectionType { Index: MapType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/MapType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MapType.java 1 Jan 2003 13:58:12 -0000 1.1.1.1 --- MapType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 4,11 **** import java.util.Iterator; import net.sf.hibernate.collection.Map; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; --- 4,11 ---- import java.util.Iterator; + import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.Map; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.SessionImplementor; Index: PersistentCollectionType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/PersistentCollectionType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PersistentCollectionType.java 1 Jan 2003 13:58:16 -0000 1.1.1.1 --- PersistentCollectionType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 11,18 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; import net.sf.hibernate.collection.PersistentCollection; ! import net.sf.hibernate.engine.*; import net.sf.hibernate.engine.SessionFactoryImplementor; ! import net.sf.hibernate.impl.*; public abstract class PersistentCollectionType extends AbstractType implements AssociationType { --- 11,19 ---- import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; + import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; ! import net.sf.hibernate.engine.Mapping; import net.sf.hibernate.engine.SessionFactoryImplementor; ! import net.sf.hibernate.engine.SessionImplementor; public abstract class PersistentCollectionType extends AbstractType implements AssociationType { *************** *** 41,46 **** public Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! //toplevel collection ! return nullSafeGet(rs, new String[] {name}, session, owner); //TODO: don't like array construction here.... } --- 42,46 ---- public Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! throw new AssertionFailure("bug in PersistentCollectionType"); } Index: PersistentEnumType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/PersistentEnumType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PersistentEnumType.java 1 Jan 2003 13:58:16 -0000 1.1.1.1 --- PersistentEnumType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 10,14 **** import java.sql.Types; ! import net.sf.hibernate.*; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.ReflectHelper; --- 10,17 ---- import java.sql.Types; ! import net.sf.hibernate.AssertionFailure; ! import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.MappingException; ! import net.sf.hibernate.PersistentEnum; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.ReflectHelper; Index: SetType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SetType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SetType.java 1 Jan 2003 13:58:17 -0000 1.1.1.1 --- SetType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 2,9 **** package net.sf.hibernate.type; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.collection.Set; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; public class SetType extends PersistentCollectionType { --- 2,9 ---- package net.sf.hibernate.type; + import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.collection.Set; import net.sf.hibernate.engine.SessionImplementor; public class SetType extends PersistentCollectionType { Index: SortedMapType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SortedMapType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SortedMapType.java 1 Jan 2003 13:58:18 -0000 1.1.1.1 --- SortedMapType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 5,12 **** import java.util.Comparator; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.collection.SortedMap; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; public class SortedMapType extends MapType { --- 5,12 ---- import java.util.Comparator; + import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.collection.SortedMap; import net.sf.hibernate.engine.SessionImplementor; public class SortedMapType extends MapType { Index: SortedSetType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SortedSetType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SortedSetType.java 1 Jan 2003 13:58:18 -0000 1.1.1.1 --- SortedSetType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 5,12 **** import java.util.Comparator; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.collection.SortedSet; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; public class SortedSetType extends SetType { --- 5,12 ---- import java.util.Comparator; + import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.collection.SortedSet; import net.sf.hibernate.engine.SessionImplementor; public class SortedSetType extends SetType { Index: TimeType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/TimeType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TimeType.java 1 Jan 2003 13:58:19 -0000 1.1.1.1 --- TimeType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 2,6 **** package net.sf.hibernate.type; ! import java.sql.*; import java.text.SimpleDateFormat; import java.util.Calendar; --- 2,10 ---- package net.sf.hibernate.type; ! import java.sql.PreparedStatement; ! import java.sql.ResultSet; ! import java.sql.SQLException; ! import java.sql.Time; ! import java.sql.Types; import java.text.SimpleDateFormat; import java.util.Calendar; Index: TimestampType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/TimestampType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TimestampType.java 1 Jan 2003 13:58:18 -0000 1.1.1.1 --- TimestampType.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 2,6 **** package net.sf.hibernate.type; ! import java.sql.*; import java.text.SimpleDateFormat; --- 2,10 ---- package net.sf.hibernate.type; ! import java.sql.PreparedStatement; ! import java.sql.ResultSet; ! import java.sql.SQLException; ! import java.sql.Timestamp; ! import java.sql.Types; import java.text.SimpleDateFormat; Index: TypeFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/TypeFactory.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TypeFactory.java 1 Jan 2003 13:58:24 -0000 1.1.1.1 --- TypeFactory.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 16,20 **** import java.util.TimeZone; ! import net.sf.hibernate.*; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.util.ReflectHelper; --- 16,25 ---- import java.util.TimeZone; ! import net.sf.hibernate.Hibernate; ! import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.Lifecycle; ! import net.sf.hibernate.MappingException; ! import net.sf.hibernate.PersistentEnum; ! import net.sf.hibernate.UserType; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.util.ReflectHelper; |
From: <one...@us...> - 2003-01-03 13:36:05
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/xml In directory sc8-pr-cvs1:/tmp/cvs-serv2643/src/net/sf/hibernate/xml Modified Files: XMLDatabinder.java Log Message: removed exceptions that occur if an object is saved or deleted multiple times in a session added <parent> subelement to <composite-element> and <nested-composite-element> Index: XMLDatabinder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/xml/XMLDatabinder.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** XMLDatabinder.java 1 Jan 2003 13:58:31 -0000 1.1.1.1 --- XMLDatabinder.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 6,31 **** import java.lang.reflect.Array; import java.sql.SQLException; ! import java.util.*; ! import javax.xml.transform.*; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.jdom.*; import org.jdom.output.DOMOutputter; import org.jdom.output.XMLOutputter; - import net.sf.hibernate.*; - import net.sf.hibernate.impl.*; - import net.sf.hibernate.persister.*; - import net.sf.hibernate.proxy.*; - import net.sf.hibernate.type.*; - import net.sf.hibernate.collection.PersistentCollection; - import net.sf.hibernate.engine.*; - import net.sf.hibernate.util.StringHelper; - /** * Implementation of the API class Databinder. NOT threadsafe. --- 6,55 ---- import java.lang.reflect.Array; import java.sql.SQLException; ! import java.util.ArrayList; ! import java.util.Collection; ! import java.util.Date; ! import java.util.HashSet; ! import java.util.Iterator; ! import java.util.List; ! import java.util.Map; ! import java.util.Set; ! import javax.xml.transform.ErrorListener; ! import javax.xml.transform.Result; ! import javax.xml.transform.Source; ! import javax.xml.transform.Transformer; ! import javax.xml.transform.TransformerException; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; + import net.sf.hibernate.Databinder; + import net.sf.hibernate.Hibernate; + import net.sf.hibernate.HibernateException; + import net.sf.hibernate.MappingException; + import net.sf.hibernate.collection.CollectionPersister; + import net.sf.hibernate.collection.PersistentCollection; + import net.sf.hibernate.engine.SessionFactoryImplementor; + import net.sf.hibernate.persister.ClassPersister; + import net.sf.hibernate.proxy.HibernateProxy; + import net.sf.hibernate.proxy.HibernateProxyHelper; + import net.sf.hibernate.proxy.LazyInitializer; + import net.sf.hibernate.type.AbstractComponentType; + import net.sf.hibernate.type.BagType; + import net.sf.hibernate.type.ListType; + import net.sf.hibernate.type.MapType; + import net.sf.hibernate.type.PersistentCollectionType; + import net.sf.hibernate.type.SetType; + import net.sf.hibernate.type.Type; + import net.sf.hibernate.util.StringHelper; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.jdom.Document; ! import org.jdom.Element; ! import org.jdom.JDOMException; import org.jdom.output.DOMOutputter; import org.jdom.output.XMLOutputter; /** * Implementation of the API class Databinder. NOT threadsafe. *************** *** 111,117 **** } - /** - * - */ private Object maybeInitializeIfProxy(Object object, Element element) throws HibernateException { if ( !(object instanceof HibernateProxy) ) return object; --- 135,138 ---- *************** *** 186,199 **** collectionElem.addContent(elemElement); } ! } else { // "real" collections PersistentCollection persistentCollection = (PersistentCollection) value; ! if (persister.isLazy() && !this.initializeLazy && !persistentCollection.wasInitialized()) { collectionElem.setAttribute("lazy", "uninitialized"); ! } else { ! if (persistentCollection.wasInitialized()) { collectionElem.setAttribute("lazy", "initialized"); ! } else { collectionElem.setAttribute("lazy", "now-initialized"); } --- 207,223 ---- collectionElem.addContent(elemElement); } ! } ! else { // "real" collections PersistentCollection persistentCollection = (PersistentCollection) value; ! if ( persister.isLazy() && !this.initializeLazy && !persistentCollection.wasInitialized() ) { collectionElem.setAttribute("lazy", "uninitialized"); ! } ! else { ! if ( persistentCollection.wasInitialized() ) { collectionElem.setAttribute("lazy", "initialized"); ! } ! else { collectionElem.setAttribute("lazy", "now-initialized"); } *************** *** 238,242 **** if ( name!=null) referenceElem.setAttribute( "name", name ); //propertyElem.setAttribute( "value", types[i].toXML( values[i] ) ); ! if ((value = maybeInitializeIfProxy(value, referenceElem)) != null) { if ( getPersister( value.getClass() ).hasIdentifierProperty() ) referenceElem.setAttribute( "uid", type.toXML( value, factory ) ); --- 262,266 ---- if ( name!=null) referenceElem.setAttribute( "name", name ); //propertyElem.setAttribute( "value", types[i].toXML( values[i] ) ); ! if ( ( value = maybeInitializeIfProxy(value, referenceElem) ) != null) { if ( getPersister( value.getClass() ).hasIdentifierProperty() ) referenceElem.setAttribute( "uid", type.toXML( value, factory ) ); *************** *** 247,251 **** // avoid duplications (including objects that have a field referencing to themselves) ! if (!processedObjects.contains(value) && !objects.contains(value)) { associatedObjects.add(value); } --- 271,275 ---- // avoid duplications (including objects that have a field referencing to themselves) ! if ( !processedObjects.contains(value) && !objects.contains(value) ) { associatedObjects.add(value); } |
From: <one...@us...> - 2003-01-03 13:36:04
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv2643/src/net/sf/hibernate/collection Modified Files: ArrayHolder.java Bag.java List.java Map.java PersistentCollection.java Set.java SortedMap.java SortedSet.java Added Files: CollectionPersister.java Log Message: removed exceptions that occur if an object is saved or deleted multiple times in a session added <parent> subelement to <composite-element> and <nested-composite-element> --- NEW FILE: CollectionPersister.java --- //$Id: CollectionPersister.java,v 1.1 2003/01/03 13:36:00 oneovthafew Exp $ package net.sf.hibernate.collection; import java.io.InvalidObjectException; import java.io.ObjectStreamException; import java.io.Serializable; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Iterator; import java.util.StringTokenizer; import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; import net.sf.hibernate.cache.CacheConcurrencyStrategy; import net.sf.hibernate.cache.CacheException; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.impl.DatastoreImpl; import net.sf.hibernate.loader.CollectionInitializer; import net.sf.hibernate.loader.CollectionLoader; import net.sf.hibernate.loader.OneToManyLoader; import net.sf.hibernate.loader.OuterJoinLoader; import net.sf.hibernate.mapping.Collection; import net.sf.hibernate.mapping.Column; import net.sf.hibernate.mapping.IndexedCollection; import net.sf.hibernate.mapping.PersistentClass; import net.sf.hibernate.mapping.Table; import net.sf.hibernate.metadata.CollectionMetadata; import net.sf.hibernate.type.EntityType; import net.sf.hibernate.type.PersistentCollectionType; import net.sf.hibernate.type.Type; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.StringHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Plugs into an instance of <tt>PersistentCollection</tt>, in order to * implement persistence of that collection while in a particular role. * * May be considered an immutable view of the mapping object */ public final class CollectionPersister implements Serializable, CollectionMetadata { private transient final String sqlSelectString; private transient final String sqlDeleteString; //private transient final String sqlSelectRowString; private transient final String sqlInsertRowString; private transient final String sqlUpdateRowString; private transient final String sqlDeleteRowString; private transient final String sqlOrderByString; private transient final boolean hasOrder; private transient final boolean isSet; private transient final Type keyType; private transient final Type indexType; private transient final Type elementType; private transient final String[] keyColumnNames; private transient final String[] indexColumnNames; private transient final String[] unquotedIndexColumnNames; private transient final String[] elementColumnNames; private transient final String[] unquotedElementColumnNames; private transient final String[] rowSelectColumnNames; private transient final Type rowSelectType; private transient final boolean primitiveArray; private transient final boolean array; private transient final boolean isOneToMany; private transient final String qualifiedTableName; private transient final boolean hasIndex; private transient final boolean isLazy; private transient final boolean isInverse; private transient final Class elementClass; private transient final CacheConcurrencyStrategy cache; private transient final PersistentCollectionType collectionType; private transient final int enableJoinedFetch; private transient final Class ownerClass; private transient final CollectionInitializer loader; private final String role; private final SessionFactoryImplementor factory; private static final Log log = LogFactory.getLog(CollectionPersister.class); public CollectionPersister(Collection collection, DatastoreImpl datastore, String defaultSchema, SessionFactoryImplementor factory) throws MappingException, CacheException { collectionType = collection.getType(); role = collection.getRole(); ownerClass = collection.getOwnerClass(); this.factory = factory; hasOrder = collection.getOrderByString()!=null; sqlOrderByString = collection.getOrderByString(); cache=collection.getCache(); keyType = collection.getKey().getType(); Iterator iter = collection.getKey().getColumnIterator(); int span = collection.getKey().getColumnSpan(); keyColumnNames = new String[span]; int k=0; while ( iter.hasNext() ) { Column col = ( (Column) iter.next() ); keyColumnNames[k] = col.getName(); k++; } isSet = collection.isSet(); isOneToMany = collection.isOneToMany(); primitiveArray = collection.isPrimitiveArray(); array = collection.isArray(); if (isOneToMany) { EntityType type = collection.getOneToMany().getType(); elementType = type; PersistentClass associatedClass = datastore.getPersistentClass( type.getPersistentClass() ); span = associatedClass.getIdentifier().getColumnSpan(); elementColumnNames = new String[span]; iter = associatedClass.getKey().getColumnIterator(); int j=0; while ( iter.hasNext() ) { Column col = (Column) iter.next(); elementColumnNames[j] = col.getName(); j++; } Table table = associatedClass.getTable(); qualifiedTableName = table.getQualifiedName(defaultSchema); enableJoinedFetch = OuterJoinLoader.EAGER; } else { Table table = collection.getTable(); qualifiedTableName = table.getQualifiedName(defaultSchema); elementType = collection.getElement().getType(); span = collection.getElement().getColumnSpan(); elementColumnNames = new String[span]; enableJoinedFetch = collection.getElement().enableJoinedFetch(); iter = collection.getElement().getColumnIterator(); int i= 0; while ( iter.hasNext() ) { Column col = (Column) iter.next(); elementColumnNames[i] = col.getName(); i++; } } unquotedElementColumnNames = StringHelper.unQuote(elementColumnNames); if ( hasIndex = collection.isIndexed() ) { IndexedCollection indexedMap = (IndexedCollection) collection; indexType = indexedMap.getIndex().getType(); int indexSpan = indexedMap.getIndex().getColumnSpan(); iter = indexedMap.getIndex().getColumnIterator(); indexColumnNames = new String[indexSpan]; int i=0; while ( iter.hasNext() ) { Column indexCol = (Column) iter.next(); indexColumnNames[i++] = indexCol.getName(); } rowSelectColumnNames = indexColumnNames; rowSelectType = indexType; unquotedIndexColumnNames = StringHelper.unQuote(indexColumnNames); } else { indexType = null; indexColumnNames = null; unquotedIndexColumnNames = null; rowSelectColumnNames = elementColumnNames; rowSelectType = elementType; } sqlSelectString = sqlSelectString(); sqlDeleteString = sqlDeleteString(); //sqlSelectRowString = sqlSelectRowString(); sqlInsertRowString = sqlInsertRowString(); sqlUpdateRowString = sqlUpdateRowString(); sqlDeleteRowString = sqlDeleteRowString(); isLazy = collection.isLazy(); isInverse = collection.isInverse(); if ( collection.isArray() ) { elementClass = ( (net.sf.hibernate.mapping.Array) collection ).getElementClass(); } else { // for non-arrays, we don't need to know the element class elementClass = null; //elementType.returnedClass(); } loader = createCollectionQuery(factory); } public CollectionInitializer getInitializer() { return loader; } private CollectionInitializer createCollectionQuery(SessionFactoryImplementor factory) throws MappingException { return isOneToMany() ? (CollectionInitializer) new OneToManyLoader(this, factory) : (CollectionInitializer) new CollectionLoader(this, factory); } public void cache(Serializable id, PersistentCollection coll, SessionImplementor s) throws HibernateException { if (cache!=null) cache.put( id, coll.disassemble(this), s.getTimestamp() ); } public PersistentCollection getCachedCollection(Serializable id, SessionImplementor s) throws HibernateException, SQLException { if (cache==null) { return null; } else { Serializable cached = (Serializable) cache.get( id, s.getTimestamp() ); if (cached==null) { return null; } else { PersistentCollection coll = collectionType.wrap(s, cached); coll.assemble(this); return coll; } } } public void softlock(Serializable id) throws CacheException { if (cache!=null) cache.lock(id); } public void releaseSoftlock(Serializable id) throws CacheException { if (cache!=null) cache.release(id); } public String getSQLOrderByString() { return sqlOrderByString; } public String getSQLOrderByString(String alias) { StringTokenizer tokens = new StringTokenizer(sqlOrderByString, ","); StringBuffer result = new StringBuffer(); while ( tokens.hasMoreTokens() ) { result.append(alias).append('.').append( tokens.nextToken().trim() ); if ( tokens.hasMoreTokens() ) result.append(", "); } return result.toString(); } public int enableJoinedFetch() { return enableJoinedFetch; } public boolean hasOrdering() { return hasOrder; } private String getSQLSelectString() { return sqlSelectString; } private String getSQLDeleteString() { return sqlDeleteString; } /*public String getSQLSelectRowString() { return sqlSelectRowString; }*/ private String getSQLInsertRowString() { return sqlInsertRowString; } private String getSQLUpdateRowString() { return sqlUpdateRowString; } private String getSQLDeleteRowString() { return sqlDeleteRowString; } public Type getKeyType() { return keyType; } public Type getIndexType() { return indexType; } public Type getElementType() { return elementType; } public Class getElementClass() { //needed by arrays return elementClass; } public Object readElement(ResultSet rs, Object owner, SessionImplementor session) throws HibernateException, SQLException { Object element = getElementType().nullSafeGet(rs, unquotedElementColumnNames, session, owner); return element; } public Object readIndex(ResultSet rs, SessionImplementor session) throws HibernateException, SQLException { return getIndexType().nullSafeGet(rs, unquotedIndexColumnNames, session, null); } public void writeElement(PreparedStatement st, Object elt, boolean writeOrder, SessionImplementor session) throws HibernateException, SQLException { getElementType().nullSafeSet(st, elt, 1+(writeOrder?0:keyColumnNames.length+(hasIndex?indexColumnNames.length:0)), session); } public void writeIndex(PreparedStatement st, Object idx, boolean writeOrder, SessionImplementor session) throws HibernateException, SQLException { getIndexType().nullSafeSet(st, idx, 1+keyColumnNames.length + (writeOrder?elementColumnNames.length:0), session); } private void writeRowSelect(PreparedStatement st, Object idx, SessionImplementor session) throws HibernateException, SQLException { rowSelectType.nullSafeSet(st, idx, 1+keyColumnNames.length, session); } public void writeKey(PreparedStatement st, Serializable id, boolean writeOrder, SessionImplementor session) throws HibernateException, SQLException { if ( id==null ) throw new NullPointerException("Null Collection Key"); //an assertion getKeyType().nullSafeSet(st, id, 1+(writeOrder?elementColumnNames.length:0), session); } public boolean isPrimitiveArray() { return primitiveArray; } public boolean isArray() { return array; } private String sqlSelectString() { boolean appendIndex = true; StringBuffer buf = new StringBuffer("select "); for ( int i=0; i<elementColumnNames.length; i++ ) { buf.append( elementColumnNames[i] ); if ( i<elementColumnNames.length-1 ) { buf.append(", "); } //Jon Lipsky's patch to allow a Map from id's to objects if ( hasIndex && indexColumnNames.length==1 && ( elementColumnNames[i].equals( indexColumnNames[0] ) ) ) { appendIndex = false; } } if ( hasIndex && appendIndex ) { for (int i=0; i<indexColumnNames.length; i++) { buf.append(", ").append( indexColumnNames[i] ); } } buf.append( " from " ) .append(qualifiedTableName) .append( " where " ) .append( StringHelper.join( " = ? and ", keyColumnNames ) ) .append( " = ?"); if (hasOrder) buf.append(" order by ").append(sqlOrderByString); return buf.toString(); } private String sqlDeleteString() { if (isOneToMany) { StringBuffer buf = new StringBuffer("update ") .append(qualifiedTableName) .append( " set " ) .append( StringHelper.join( " = null, ", keyColumnNames ) ) .append( " = null" ); if ( hasIndex ) { buf.append(", ") .append( StringHelper.join( " = null, ", indexColumnNames ) ) .append( " = null" ); } buf.append( " where " ) .append( StringHelper.join( " = ? and ", keyColumnNames ) ) .append( " = ?" ); return buf.toString(); } else { return new StringBuffer("delete from ") .append(qualifiedTableName) .append(" where ") .append( StringHelper.join( " = ? and ", keyColumnNames ) ) .append(" = ?") .toString(); } } private String sqlInsertRowString() { if (isOneToMany) { StringBuffer buf = new StringBuffer("update ") .append(qualifiedTableName) .append( " set " ) .append( StringHelper.join( " = ?, ", keyColumnNames ) ) .append( " = ?"); if (hasIndex) { buf.append( ", " ) .append( StringHelper.join( " = ?, ", indexColumnNames ) ) .append( " = ?"); } buf.append( " where " ) .append( StringHelper.join( " = ? and ", elementColumnNames ) ) .append( " = ?" ); return buf.toString(); } else { StringBuffer buf = new StringBuffer("insert into ") .append(qualifiedTableName) .append(" ( ") .append( StringHelper.join( ", ", keyColumnNames ) ); if (hasIndex) { buf.append(", ").append( StringHelper.join(", ", indexColumnNames) ); } for ( int i=0; i<elementColumnNames.length; i++) { buf.append( ", " ).append( elementColumnNames[i] ); } buf.append(" ) values ( ?"); buf.append( StringHelper.repeat( ", ?", elementColumnNames.length + keyColumnNames.length - 1 + ( hasIndex ? indexColumnNames.length:0 ) ) ); return buf.append(" )").toString(); } } /*private String sqlSelectRowString() { return ""; //TODO }*/ private String sqlUpdateRowString() { if (isOneToMany) { return null; } else { return new StringBuffer("update ") .append(qualifiedTableName) .append(" set ") .append( StringHelper.join( " = ?, ", elementColumnNames ) ) .append(" = ? where ") .append( StringHelper.join( " = ? and ", keyColumnNames ) ) .append( " = ? and " ) .append( StringHelper.join( " = ? and ", rowSelectColumnNames ) ) .append(" = ?") .toString(); } } private String sqlDeleteRowString() { return new StringBuffer( sqlDeleteString() ) .append(" and ") .append( StringHelper.join( " = ? and ", rowSelectColumnNames ) ) .append(" = ?") .toString(); } public String[] getIndexColumnNames() { return indexColumnNames; } public String[] getElementColumnNames() { return elementColumnNames; } public String[] getKeyColumnNames() { return keyColumnNames; } public boolean isOneToMany() { return isOneToMany; } public boolean hasIndex() { return hasIndex; } public boolean isLazy() { return isLazy; } public boolean isInverse() { return isInverse; } public String getQualifiedTableName() { return qualifiedTableName; } public final void remove(Serializable id, SessionImplementor session) throws SQLException, HibernateException { if ( !isInverse ) { if ( log.isDebugEnabled() ) log.debug("Deleting collection: " + role + "#" + id); // Remove all the old entries PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteString() ); try { writeKey(st, id, false, session); session.getBatcher().addToBatch(-1); } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } } public final void recreate(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { if (!isInverse) { if ( log.isDebugEnabled() ) log.debug("Inserting collection: " + role + "#" + id); //create all the new entries Iterator entries = collection.entries(); if ( entries.hasNext() ) { PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLInsertRowString() ); int i=0; try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( !isOneToMany || entry!=null ) { writeKey(st, id, false, session); collection.writeTo(st, this, entry, i, false); session.getBatcher().addToBatch(1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } } } public final void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { if (!isInverse) { if ( log.isDebugEnabled() ) log.debug("Deleting rows of collection: " + role + "#" + id); //delete all the deleted entries Iterator entries = collection.getDeletes(elementType); if ( entries.hasNext() ) { PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteRowString() ); try { while ( entries.hasNext() ) { writeKey(st, id, false, session ); writeRowSelect( st, entries.next(), session ); session.getBatcher().addToBatch(-1); } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } } } private final void update(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { PreparedStatement st = null; Iterator entries = collection.entries(); int i=0; try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( collection.needsUpdating(entry, i, elementType) ) { if (st==null) st = session.getBatcher().prepareBatchStatement( getSQLUpdateRowString() ); writeKey(st, id, true, session); collection.writeTo( st, this, entry, i, true ); session.getBatcher().addToBatch(1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } private final void updateOneToMany(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { PreparedStatement rmvst = null; int i=0; Iterator entries = collection.entries(); try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( collection.needsUpdating(entry, i, elementType) ) { // will still be issued when it used to be null if (rmvst==null) rmvst = session.getBatcher().prepareBatchStatement( getSQLDeleteRowString() ); writeKey(rmvst, id, false, session); writeIndex(rmvst, collection.getIndex(entry, i), false, session); session.getBatcher().addToBatch(-1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } // finish all the "removes" first to take care of possible unique constraints // and so that we can take advantage of batching PreparedStatement insst = null; i=0; entries = collection.entries(); try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( entry!=null || collection.needsUpdating(entry, i, elementType) ) { if (insst==null) insst = session.getBatcher().prepareBatchStatement( getSQLInsertRowString() ); writeKey(insst, id, false, session); collection.writeTo(insst, this, entry, i, false); session.getBatcher().addToBatch(1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } public final void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { if (!isInverse) { if ( log.isDebugEnabled() ) log.debug("Updating rows of collection: " + role + "#" + id); //update all the modified entries if (isOneToMany) { updateOneToMany(id, collection, session); } else { update(id, collection, session); } } } public final void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { if (!isInverse) { if ( log.isDebugEnabled() ) log.debug("Inserting rows of collection: " + role + "#" + id); //insert all the new entries Iterator entries = collection.entries(); PreparedStatement st = null; int i=0; try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( collection.needsInserting(entry, i, elementType) && ( !isOneToMany || entry!=null ) ) { if (st==null) st = session.getBatcher().prepareBatchStatement( getSQLInsertRowString() ); writeKey(st, id, false, session); collection.writeTo( st, this, entry, i, false ); session.getBatcher().addToBatch(1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } } public String getRole() { return role; } Object readResolve() throws ObjectStreamException { try { return factory.getCollectionPersister(role); } catch (MappingException me) { throw new InvalidObjectException( me.getMessage() ); } } public boolean isSet() { return isSet; } public Class getOwnerClass() { return ownerClass; } } Index: ArrayHolder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ArrayHolder.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ArrayHolder.java 1 Jan 2003 13:53:55 -0000 1.1.1.1 --- ArrayHolder.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 17,21 **** import net.sf.hibernate.type.*; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; /** --- 17,20 ---- *************** *** 114,123 **** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { // relys on the fact that elements are returned sorted by index! ! Object element = persister.readElement( rs, session); int index = ( (Integer) persister.readIndex(rs, session) ).intValue(); for ( int i = temp.size(); i<=index; i++) { --- 113,122 ---- * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { // relys on the fact that elements are returned sorted by index! ! Object element = persister.readElement(rs, owner, session); int index = ( (Integer) persister.readIndex(rs, session) ).intValue(); for ( int i = temp.size(); i<=index; i++) { Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Bag.java 1 Jan 2003 13:53:58 -0000 1.1.1.1 --- Bag.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 18,22 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.type.Type; --- 18,21 ---- *************** *** 85,90 **** * @see net.sf.hibernate.collections.PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, session) ; bag.add(element); return element; --- 84,89 ---- * @see net.sf.hibernate.collections.PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, owner, session) ; bag.add(element); return element; Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** List.java 1 Jan 2003 13:53:59 -0000 1.1.1.1 --- List.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 17,21 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.type.Type; --- 17,20 ---- *************** *** 294,299 **** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, session) ; int index = ( (Integer) persister.readIndex(rs, session) ).intValue(); for ( int i = list.size(); i<=index; i++) { --- 293,298 ---- * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, owner, session) ; int index = ( (Integer) persister.readIndex(rs, session) ).intValue(); for ( int i = list.size(); i<=index; i++) { Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Map.java 1 Jan 2003 13:54:02 -0000 1.1.1.1 --- Map.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 16,20 **** import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.LinkedHashCollectionHelper; - import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.type.Type; --- 16,19 ---- *************** *** 201,206 **** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, session); Object index = persister.readIndex(rs, session); map.put(index, element); --- 200,205 ---- * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, owner, session); Object index = persister.readIndex(rs, session); map.put(index, element); Index: PersistentCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/PersistentCollection.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PersistentCollection.java 1 Jan 2003 13:54:05 -0000 1.1.1.1 --- PersistentCollection.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 3,7 **** import net.sf.hibernate.type.Type; - import net.sf.hibernate.impl.CollectionPersister; import java.util.ArrayList; --- 3,6 ---- *************** *** 155,159 **** public abstract Iterator entries(); public abstract void readEntries(Iterator entries); ! public abstract Object readFrom(ResultSet rs, CollectionPersister role) throws HibernateException, SQLException; public abstract void writeTo(PreparedStatement st, CollectionPersister role, Object entry, int i, boolean writeOrder) throws HibernateException, SQLException; --- 154,158 ---- public abstract Iterator entries(); public abstract void readEntries(Iterator entries); ! public abstract Object readFrom(ResultSet rs, CollectionPersister role, Object owner) throws HibernateException, SQLException; public abstract void writeTo(PreparedStatement st, CollectionPersister role, Object entry, int i, boolean writeOrder) throws HibernateException, SQLException; Index: Set.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Set.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Set.java 1 Jan 2003 13:54:07 -0000 1.1.1.1 --- Set.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 17,21 **** import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.LinkedHashCollectionHelper; - import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.type.Type; --- 17,20 ---- *************** *** 225,230 **** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, session); set.add(element); return element; --- 224,229 ---- * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, owner, session); set.add(element); return element; Index: SortedMap.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedMap.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SortedMap.java 1 Jan 2003 13:54:08 -0000 1.1.1.1 --- SortedMap.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 11,15 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; --- 11,14 ---- Index: SortedSet.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedSet.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SortedSet.java 1 Jan 2003 13:54:08 -0000 1.1.1.1 --- SortedSet.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 9,13 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; --- 9,12 ---- |
From: <one...@us...> - 2003-01-03 13:36:04
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping In directory sc8-pr-cvs1:/tmp/cvs-serv2643/src/net/sf/hibernate/mapping Modified Files: Collection.java Log Message: removed exceptions that occur if an object is saved or deleted multiple times in a session added <parent> subelement to <composite-element> and <nested-composite-element> Index: Collection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Collection.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Collection.java 2 Jan 2003 11:01:49 -0000 1.3 --- Collection.java 3 Jan 2003 13:36:01 -0000 1.4 *************** *** 218,221 **** --- 218,225 ---- return inverse; } + + public Class getOwnerClass() { + return owner.getPersistentClass(); + } } |
From: <one...@us...> - 2003-01-03 13:36:04
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv2643/src/net/sf/hibernate/impl Modified Files: FilterImpl.java QueryImpl.java ScheduledCollectionAction.java ScheduledCollectionRecreate.java ScheduledCollectionRemove.java ScheduledCollectionUpdate.java SessionFactoryImpl.java SessionImpl.java Removed Files: CollectionPersister.java Log Message: removed exceptions that occur if an object is saved or deleted multiple times in a session added <parent> subelement to <composite-element> and <nested-composite-element> Index: FilterImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/FilterImpl.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** FilterImpl.java 1 Jan 2003 13:55:45 -0000 1.1.1.1 --- FilterImpl.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 27,33 **** */ public Iterator iterate() throws SQLException, HibernateException { ! values.add(0, null); ! types.add(0, null); ! return session.iterateFilter(collection, queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } --- 27,33 ---- */ public Iterator iterate() throws SQLException, HibernateException { ! getValues().add(0, null); ! getTypes().add(0, null); ! return getSession().iterateFilter(collection, getQueryString(), getValues().toArray(), (Type[]) getTypes().toArray(NO_TYPES), getSelection(), getNamedParams() ); } *************** *** 36,42 **** */ public List list() throws SQLException, HibernateException { ! values.add(0, null); ! types.add(0, null); ! return session.filter(collection, queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } --- 36,42 ---- */ public List list() throws SQLException, HibernateException { ! getValues().add(0, null); ! getTypes().add(0, null); ! return getSession().filter(collection, getQueryString(), getValues().toArray(), (Type[]) getTypes().toArray(NO_TYPES), getSelection(), getNamedParams() ); } Index: QueryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/QueryImpl.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** QueryImpl.java 1 Jan 2003 13:55:48 -0000 1.1.1.1 --- QueryImpl.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 2,6 **** package net.sf.hibernate.impl; - import java.util.HashMap; import java.io.Serializable; import java.math.BigDecimal; --- 2,5 ---- *************** *** 10,17 **** import java.util.Collection; import java.util.Date; ! import java.util.Map; import java.util.Iterator; import java.util.List; import java.util.Locale; import net.sf.hibernate.Hibernate; --- 9,17 ---- import java.util.Collection; import java.util.Date; ! import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; + import java.util.Map; import net.sf.hibernate.Hibernate; *************** *** 21,40 **** import net.sf.hibernate.Query; import net.sf.hibernate.ScrollableResults; ! import net.sf.hibernate.engine.*; import net.sf.hibernate.util.ArrayHelper; import net.sf.hibernate.util.ReflectHelper; import net.sf.hibernate.util.StringHelper; - import net.sf.hibernate.type.Type; - import net.sf.hibernate.type.TypeFactory; public class QueryImpl implements Query { ! final SessionImplementor session; ! String queryString; ! RowSelection selection; ! ArrayList values = new ArrayList(4); ! ArrayList types = new ArrayList(4); ! Map namedParams = new HashMap(4); public QueryImpl(String queryString, SessionImplementor session) { --- 21,42 ---- import net.sf.hibernate.Query; import net.sf.hibernate.ScrollableResults; ! import net.sf.hibernate.engine.RowSelection; ! import net.sf.hibernate.engine.SessionImplementor; ! import net.sf.hibernate.engine.TypedValue; ! import net.sf.hibernate.type.Type; ! import net.sf.hibernate.type.TypeFactory; import net.sf.hibernate.util.ArrayHelper; import net.sf.hibernate.util.ReflectHelper; import net.sf.hibernate.util.StringHelper; public class QueryImpl implements Query { ! private final SessionImplementor session; ! private String queryString; ! private RowSelection selection; ! private ArrayList values = new ArrayList(4); ! private ArrayList types = new ArrayList(4); ! private Map namedParams = new HashMap(4); public QueryImpl(String queryString, SessionImplementor session) { *************** *** 46,63 **** static final Type[] NO_TYPES = new Type[0]; - public static final class TypedValue { - protected TypedValue(Type t, Object o) { - type=t; value=o; - } - public Type type; - public Object value; - } - - public static final class RowSelection { - public Integer firstRow; - public Integer maxRows; - public Integer timeout; - } - public Iterator iterate() throws SQLException, HibernateException { return session.iterate(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); --- 48,51 ---- *************** *** 73,85 **** public void setMaxResults(int maxResults) { ! selection.maxRows = new Integer(maxResults); } public void setTimeout(int timeout) { ! selection.timeout = new Integer(timeout); } public void setFirstResult(int firstResult) { ! selection.firstRow = new Integer(firstResult); } --- 61,73 ---- public void setMaxResults(int maxResults) { ! selection.setMaxRows(new Integer(maxResults)); } public void setTimeout(int timeout) { ! selection.setTimeout(new Integer(timeout)); } public void setFirstResult(int firstResult) { ! selection.setFirstRow(new Integer(firstResult)); } *************** *** 330,333 **** --- 318,345 ---- catch (PropertyNotFoundException pnfe) {} } + } + + SessionImplementor getSession() { + return session; + } + + ArrayList getValues() { + return values; + } + + ArrayList getTypes() { + return types; + } + + RowSelection getSelection() { + return selection; + } + + String getQueryString() { + return queryString; + } + + Map getNamedParams() { + return namedParams; } Index: ScheduledCollectionAction.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/ScheduledCollectionAction.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ScheduledCollectionAction.java 1 Jan 2003 13:55:48 -0000 1.1.1.1 --- ScheduledCollectionAction.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- import net.sf.hibernate.cache.CacheException; + import net.sf.hibernate.collection.*; import net.sf.hibernate.engine.*; import net.sf.hibernate.impl.SessionImpl.Executable; Index: ScheduledCollectionRecreate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/ScheduledCollectionRecreate.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ScheduledCollectionRecreate.java 1 Jan 2003 13:55:48 -0000 1.1.1.1 --- ScheduledCollectionRecreate.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- import java.sql.SQLException; import net.sf.hibernate.*; + import net.sf.hibernate.collection.*; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.*; Index: ScheduledCollectionRemove.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/ScheduledCollectionRemove.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ScheduledCollectionRemove.java 1 Jan 2003 13:55:48 -0000 1.1.1.1 --- ScheduledCollectionRemove.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- import java.sql.SQLException; import net.sf.hibernate.*; + import net.sf.hibernate.collection.*; import net.sf.hibernate.engine.*; Index: ScheduledCollectionUpdate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/ScheduledCollectionUpdate.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ScheduledCollectionUpdate.java 1 Jan 2003 13:55:49 -0000 1.1.1.1 --- ScheduledCollectionUpdate.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- import java.sql.SQLException; import net.sf.hibernate.*; + import net.sf.hibernate.collection.*; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.engine.*; Index: SessionFactoryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionFactoryImpl.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SessionFactoryImpl.java 1 Jan 2003 13:55:53 -0000 1.1.1.1 --- SessionFactoryImpl.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 45,48 **** --- 45,49 ---- import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cache.Timestamper; + import net.sf.hibernate.collection.*; import net.sf.hibernate.connection.ConnectionProvider; import net.sf.hibernate.connection.ConnectionProviderFactory; Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SessionImpl.java 2 Jan 2003 11:01:49 -0000 1.3 --- SessionImpl.java 3 Jan 2003 13:36:01 -0000 1.4 *************** *** 47,50 **** --- 47,51 ---- import net.sf.hibernate.type.TypeFactory; import net.sf.hibernate.cache.CacheException; + import net.sf.hibernate.collection.*; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.collection.ArrayHolder; *************** *** 482,487 **** if (object==null) throw new NullPointerException("attempted to save null"); ! Serializable id = getPersister(object).getIdentifierGenerator().generate(this, object); ! return doSave(object, id); } --- 483,495 ---- if (object==null) throw new NullPointerException("attempted to save null"); ! EntityEntry e = getEntry(object); ! if ( e!=null ) { ! log.trace( "object already associated with session" ); ! return e.id; ! } ! else { ! Serializable id = getPersister(object).getIdentifierGenerator().generate(this, object); ! return doSave(object, id); ! } } *************** *** 494,498 **** if (id==null) throw new NullPointerException("null identifier passed to insert()"); ! doSave(object, id); } --- 502,516 ---- if (id==null) throw new NullPointerException("null identifier passed to insert()"); ! EntityEntry e = getEntry(object); ! if ( e!=null ) { ! if ( !id.equals(e.id) ) throw new PersistentObjectException( ! "object passed to save() was already persistent: " + ! infoString(e.persister, id) ! ); ! log.trace( "object already associated with session" ); ! } ! else { ! doSave(object, id); ! } } *************** *** 500,508 **** ClassPersister persister = getPersister(object); ! ! if ( isEntryFor(object) ) throw new PersistentObjectException( ! "attempted to save an instance of that was already associated with the Session: " + infoString(persister, id) ! ); ! Key key = null; final boolean identityCol; --- 518,522 ---- ClassPersister persister = getPersister(object); ! Key key = null; final boolean identityCol; *************** *** 519,528 **** } ! if ( log.isTraceEnabled() ) log.trace( "saving " + infoString(persister,id)); if (!identityCol) { // if the id is generated by the database, we assign the key later key = new Key(id, persister); ! if ( getEntity(key) != null ) throw new HibernateException("The generated ID is already in use: " + infoString(persister, id)); persister.setIdentifier(object, id); --- 533,545 ---- } ! if ( log.isTraceEnabled() ) log.trace( "saving " + infoString(persister,id) ); if (!identityCol) { // if the id is generated by the database, we assign the key later key = new Key(id, persister); ! if ( getEntity(key) != null ) throw new HibernateException( ! "The generated ID is already in use: " + ! infoString(persister, id) ! ); persister.setIdentifier(object, id); *************** *** 695,699 **** final ClassPersister persister; if (entry==null) { ! log.trace("deleting a transient object"); persister = getPersister(object); --- 712,716 ---- final ClassPersister persister; if (entry==null) { ! log.trace("deleting a transient instance"); persister = getPersister(object); *************** *** 703,707 **** if (old!=null) { ! throw new HibernateException( "Another object with the same id was already associated with the session: " + infoString(persister, id) ); } --- 720,727 ---- if (old!=null) { ! throw new HibernateException( ! "Another object with the same id was already associated with the session: " + ! infoString(persister, id) ! ); } *************** *** 721,730 **** } else { persister = entry.persister; } ! if ( !persister.isMutable() ) throw new HibernateException( "attempted to delete an object of immutable class: " + infoString(persister) ); ! ! ! if (entry.status!=LOADED) throw new ObjectDeletedException("Object was already deleted", entry.id); if ( log.isTraceEnabled() ) log.trace( "deleting " + infoString(persister, entry.id) ); --- 741,757 ---- } else { + log.trace("deleting a persistent instance"); + + if ( entry.status==DELETED || entry.status==GONE ) { + log.trace("object was already deleted"); + return; + } persister = entry.persister; } ! ! if ( !persister.isMutable() ) throw new HibernateException( ! "attempted to delete an object of immutable class: " + ! infoString(persister) ! ); if ( log.isTraceEnabled() ) log.trace( "deleting " + infoString(persister, entry.id) ); *************** *** 882,887 **** if ( persister.hasIdentifierProperty() ) { ! if ( !isEntryFor(object) ) { //the object is transient ! Serializable id = persister.getIdentifier(object); --- 909,918 ---- if ( persister.hasIdentifierProperty() ) { ! if ( isEntryFor(object) ) { ! log.trace("object already associated with session"); ! // do nothing ! } ! else { ! // the object is transient Serializable id = persister.getIdentifier(object); *************** *** 907,912 **** Object object = HibernateProxyHelper.unproxy(obj, this); ! if ( !isEntryFor(object) ) { //the object is transient ! ClassPersister persister = getPersister(object); if ( persister.hasIdentifierProperty() ) { --- 938,948 ---- Object object = HibernateProxyHelper.unproxy(obj, this); ! if ( isEntryFor(object) ) { ! // do nothing for persistent instances ! log.trace("object already associated with session"); ! } ! else { ! ! // the object is transient ClassPersister persister = getPersister(object); if ( persister.hasIdentifierProperty() ) { *************** *** 927,931 **** } ! // else do nothing for persistent instances } --- 963,967 ---- } ! } *************** *** 943,947 **** else { if ( !e.id.equals(id) ) throw new PersistentObjectException( ! "The instance passed to update() was already persistent with a different id: " + e.id ); } --- 979,984 ---- else { if ( !e.id.equals(id) ) throw new PersistentObjectException( ! "The instance passed to update() was already persistent: " + ! infoString(e.persister, id) ); } *************** *** 1006,1010 **** } ! public List find(String query, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams) throws SQLException, HibernateException { if ( log.isTraceEnabled() ) { --- 1043,1047 ---- } ! public List find(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws SQLException, HibernateException { if ( log.isTraceEnabled() ) { *************** *** 1065,1069 **** } ! public Iterator iterate(String query, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams) throws HibernateException, SQLException { if ( log.isTraceEnabled() ) { --- 1102,1106 ---- } ! public Iterator iterate(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws HibernateException, SQLException { if ( log.isTraceEnabled() ) { *************** *** 1094,1098 **** } ! public ScrollableResults scroll(String query, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams) throws HibernateException, SQLException { if ( log.isTraceEnabled() ) { --- 1131,1135 ---- } ! public ScrollableResults scroll(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws HibernateException, SQLException { if ( log.isTraceEnabled() ) { *************** *** 1470,1474 **** if ( log.isTraceEnabled() ) log.trace( "attempting to resolve " + infoString(theClass, id) ); - final Object finalResult; final boolean isOptionalObject = optionalObject!=null; --- 1507,1510 ---- *************** *** 1484,1488 **** } lock(old, lockMode); ! finalResult = old; } --- 1520,1524 ---- } lock(old, lockMode); ! return old; } *************** *** 1493,1508 **** if (entry!=null) { ClassPersister subclassPersister = getPersister( entry.getSubclass() ); ! finalResult = (isOptionalObject) ? optionalObject : subclassPersister.instantiate(id); ! addEntry(finalResult, LOADING, null, id, null, LockMode.NONE, true, subclassPersister); //make it circular-reference safe ! addEntity( new Key(id, persister), finalResult ); ! Object[] values = entry.assemble(finalResult, id, subclassPersister, this); // intializes cached by side-effect Type[] types = subclassPersister.getPropertyTypes(); TypeFactory.deepCopy(values, types, values); Object version = Versioning.getVersion(values, subclassPersister); if ( log.isTraceEnabled() ) log.trace("Cached Version: " + version); ! addEntry(finalResult, LOADED, values, id, version, LockMode.NONE, true, subclassPersister); // upgrade the lock if necessary: ! lock(finalResult, lockMode); //if ( persister.isMutable() ) tableAccesses.add( persister.getQualifiedTableName() ); // TODO: not necessary for readonly cache } --- 1529,1545 ---- if (entry!=null) { ClassPersister subclassPersister = getPersister( entry.getSubclass() ); ! Object result = (isOptionalObject) ? optionalObject : subclassPersister.instantiate(id); ! addEntry(result, LOADING, null, id, null, LockMode.NONE, true, subclassPersister); //make it circular-reference safe ! addEntity( new Key(id, persister), result ); ! Object[] values = entry.assemble(result, id, subclassPersister, this); // intializes cached by side-effect Type[] types = subclassPersister.getPropertyTypes(); TypeFactory.deepCopy(values, types, values); Object version = Versioning.getVersion(values, subclassPersister); if ( log.isTraceEnabled() ) log.trace("Cached Version: " + version); ! addEntry(result, LOADED, values, id, version, LockMode.NONE, true, subclassPersister); // upgrade the lock if necessary: ! lock(result, lockMode); //if ( persister.isMutable() ) tableAccesses.add( persister.getQualifiedTableName() ); // TODO: not necessary for readonly cache + return result; } *************** *** 1511,1520 **** //otherwise go ahead and load it! // Note: you can't use "for update" with an outer join ! finalResult = persister.load(id, optionalObject, lockMode, this); } } - return finalResult; } --- 1548,1556 ---- //otherwise go ahead and load it! // Note: you can't use "for update" with an outer join ! return persister.load(id, optionalObject, lockMode, this); } } } *************** *** 2191,2203 **** if ( log.isTraceEnabled() ) log.trace( "initializing collection " + infoString(ce.loadedPersister, ce.loadedID) ); ! ! CollectionPersister p = ce.loadedPersister; ! collection.beforeInitialize(p); ! p.getInitializer().initialize(ce.loadedID, collection, this); //tableAccesses.add( ce.loadedPersister.getQualifiedTableName() ); ce.initialized = true; ce.postInitialize(collection); ! if (!writing) ce.loadedPersister.cache(ce.loadedID, collection, this); } --- 2227,2243 ---- if ( log.isTraceEnabled() ) log.trace( "initializing collection " + infoString(ce.loadedPersister, ce.loadedID) ); ! ! CollectionPersister persister = ce.loadedPersister; ! Serializable id = ce.loadedID; ! ! Object owner = getEntity( new Key( id, getPersister( persister.getOwnerClass() ) ) ); ! ! collection.beforeInitialize(persister); ! persister.getInitializer().initialize(id, collection, owner, this); //tableAccesses.add( ce.loadedPersister.getQualifiedTableName() ); ce.initialized = true; ce.postInitialize(collection); ! if (!writing) persister.cache(id, collection, this); } *************** *** 2323,2327 **** ! private FilterTranslator getFilterTranslator(Object collection, String filter, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams, boolean scalar) throws SQLException, HibernateException { if ( log.isTraceEnabled() ) { --- 2363,2367 ---- ! private FilterTranslator getFilterTranslator(Object collection, String filter, Object[] values, Type[] types, RowSelection selection, Map namedParams, boolean scalar) throws SQLException, HibernateException { if ( log.isTraceEnabled() ) { *************** *** 2360,2364 **** } ! public List filter(Object collection, String filter, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams) throws SQLException, HibernateException { String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory); --- 2400,2404 ---- } ! public List filter(Object collection, String filter, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws SQLException, HibernateException { String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory); *************** *** 2386,2390 **** } ! public Iterator iterateFilter(Object collection, String filter, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams) throws SQLException, HibernateException { String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory); --- 2426,2430 ---- } ! public Iterator iterateFilter(Object collection, String filter, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws SQLException, HibernateException { String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory); --- CollectionPersister.java DELETED --- |
From: <one...@us...> - 2003-01-03 13:36:04
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql In directory sc8-pr-cvs1:/tmp/cvs-serv2643/src/net/sf/hibernate/hql Modified Files: PathExpressionParser.java QueryTranslator.java Log Message: removed exceptions that occur if an object is saved or deleted multiple times in a session added <parent> subelement to <composite-element> and <nested-composite-element> Index: PathExpressionParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/PathExpressionParser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PathExpressionParser.java 1 Jan 2003 13:54:33 -0000 1.1.1.1 --- PathExpressionParser.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 7,11 **** import net.sf.hibernate.QueryException; import net.sf.hibernate.util.StringHelper; ! import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.persister.*; import net.sf.hibernate.persister.ClassPersister; --- 7,11 ---- import net.sf.hibernate.QueryException; import net.sf.hibernate.util.StringHelper; ! import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.persister.*; import net.sf.hibernate.persister.ClassPersister; Index: QueryTranslator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/QueryTranslator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** QueryTranslator.java 1 Jan 2003 13:54:37 -0000 1.1.1.1 --- QueryTranslator.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 24,37 **** import net.sf.hibernate.QueryException; import net.sf.hibernate.ScrollableResults; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.ArrayHelper; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.ReflectHelper; import net.sf.hibernate.util.StringHelper; - import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.impl.IteratorImpl; - import net.sf.hibernate.impl.QueryImpl; import net.sf.hibernate.impl.ScrollableResultsImpl; import net.sf.hibernate.loader.Loader; import net.sf.hibernate.persister.*; --- 24,39 ---- import net.sf.hibernate.QueryException; import net.sf.hibernate.ScrollableResults; + import net.sf.hibernate.collection.CollectionPersister; + import net.sf.hibernate.engine.RowSelection; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; + import net.sf.hibernate.engine.TypedValue; import net.sf.hibernate.util.ArrayHelper; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.ReflectHelper; import net.sf.hibernate.util.StringHelper; import net.sf.hibernate.impl.IteratorImpl; import net.sf.hibernate.impl.ScrollableResultsImpl; + import net.sf.hibernate.engine.TypedValue; import net.sf.hibernate.loader.Loader; import net.sf.hibernate.persister.*; *************** *** 774,781 **** Map.Entry e = (Map.Entry) iter.next(); String name = (String) e.getKey(); ! QueryImpl.TypedValue typedval = (QueryImpl.TypedValue) e.getValue(); int[] locs = getNamedParameterLocs(name); for ( int i=0; i<locs.length; i++ ) { ! typedval.type.nullSafeSet( ps, typedval.value, locs[i], session ); } } --- 776,783 ---- Map.Entry e = (Map.Entry) iter.next(); String name = (String) e.getKey(); ! TypedValue typedval = (TypedValue) e.getValue(); int[] locs = getNamedParameterLocs(name); for ( int i=0; i<locs.length; i++ ) { ! typedval.getType().nullSafeSet( ps, typedval.getValue(), locs[i], session ); } } *************** *** 783,787 **** } ! public Iterator iterate(Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, false, session ); --- 785,789 ---- } ! public Iterator iterate(Object[] values, Type[] types, RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, false, session ); *************** *** 800,804 **** } ! public ScrollableResults scroll(Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, true, session ); --- 802,806 ---- } ! public ScrollableResults scroll(Object[] values, Type[] types, RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, true, session ); |
From: <one...@us...> - 2003-01-03 13:36:04
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv2643/src/net/sf/hibernate/test Modified Files: Baz.hbm.xml FooBarTest.java FooComponent.java Log Message: removed exceptions that occur if an object is saved or deleted multiple times in a session added <parent> subelement to <composite-element> and <nested-composite-element> Index: Baz.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Baz.hbm.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Baz.hbm.xml 2 Jan 2003 11:01:49 -0000 1.2 --- Baz.hbm.xml 3 Jan 2003 13:36:01 -0000 1.3 *************** *** 37,40 **** --- 37,41 ---- <index column="i"/> <composite-element class="net.sf.hibernate.test.FooComponent"> + <parent name="baz"/> <property name="name"> <column name="name" length="56"/> Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FooBarTest.java 2 Jan 2003 11:01:49 -0000 1.2 --- FooBarTest.java 3 Jan 2003 13:36:01 -0000 1.3 *************** *** 286,289 **** --- 286,290 ---- assertTrue( baz.getCustoms().size()==4 && baz.getCustoms().get(0)!=null, "collection of custom types - added element" ); assertTrue ( baz.getComponents()[1].getSubcomponent()!=null, "component of component in collection" ); + assertTrue( baz.getComponents()[1].getBaz()==baz ); assertTrue( ( (FooProxy) baz.getFooSet().iterator().next() ).getKey().equals( foo.getKey() ), "set of objects"); assertTrue( baz.getStringArray().length==0, "collection removed" ); *************** *** 362,367 **** s.delete( baz.getTopGlarchez().get( new Character('G') ) ); s.delete( baz.getTopGlarchez().get( new Character('H') ) ); ! System.out.println( ">>>" + s.delete("from bar in class net.sf.hibernate.test.Bar") ); ! //assertTrue( s.delete("from bar in class net.sf.hibernate.test.Bar")==2 ); FooProxy[] arr = baz.getFooArray(); assertTrue( arr.length==4 && arr[1].getKey().equals( foo.getKey() ), "new array of objects" ); --- 363,367 ---- s.delete( baz.getTopGlarchez().get( new Character('G') ) ); s.delete( baz.getTopGlarchez().get( new Character('H') ) ); ! assertTrue( s.delete("from bar in class net.sf.hibernate.test.Bar")==1 ); FooProxy[] arr = baz.getFooArray(); assertTrue( arr.length==4 && arr[1].getKey().equals( foo.getKey() ), "new array of objects" ); Index: FooComponent.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooComponent.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** FooComponent.java 1 Jan 2003 13:57:04 -0000 1.1.1.1 --- FooComponent.java 3 Jan 2003 13:36:01 -0000 1.2 *************** *** 13,16 **** --- 13,17 ---- GlarchProxy glarch; private Foo parent; + private Baz baz; public String toString() { *************** *** 102,105 **** --- 103,114 ---- public void setParent(Foo parent) { this.parent = parent; + } + + public Baz getBaz() { + return baz; + } + + public void setBaz(Baz baz) { + this.baz = baz; } |