You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <one...@us...> - 2003-01-26 02:37:05
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type In directory sc8-pr-cvs1:/tmp/cvs-serv30323/sf/hibernate/type Modified Files: CalendarDateType.java CalendarType.java TimeZoneType.java Log Message: javadoc for Configuration Index: CalendarDateType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/CalendarDateType.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CalendarDateType.java 19 Jan 2003 11:47:08 -0000 1.4 --- CalendarDateType.java 26 Jan 2003 02:37:02 -0000 1.5 *************** *** 17,25 **** public class CalendarDateType extends MutableType { ! /** ! * @see net.sf.hibernate.type.NullableType#get(ResultSet, String) ! */ ! public Object get(ResultSet rs, String name) ! throws HibernateException, SQLException { Date date = rs.getDate(name); --- 17,21 ---- public class CalendarDateType extends MutableType { ! public Object get(ResultSet rs, String name) throws HibernateException, SQLException { Date date = rs.getDate(name); *************** *** 35,57 **** } ! /** ! * @see net.sf.hibernate.type.NullableType#set(PreparedStatement, Object, int) ! */ ! public void set(PreparedStatement st, Object value, int index) ! throws HibernateException, SQLException { st.setDate( index, new Date( ( (Calendar) value ).getTime().getTime() ) ); } - /** - * @see net.sf.hibernate.type.NullableType#sqlType() - */ public int sqlType() { return Types.DATE; } - /** - * @see net.sf.hibernate.type.NullableType#toXML(Object) - */ public String toXML(Object value) throws HibernateException { //TODO: --- 31,43 ---- } ! public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { st.setDate( index, new Date( ( (Calendar) value ).getTime().getTime() ) ); } public int sqlType() { return Types.DATE; } public String toXML(Object value) throws HibernateException { //TODO: *************** *** 59,79 **** } - /** - * @see net.sf.hibernate.type.NullableType#deepCopyNotNull(Object) - */ public Object deepCopyNotNull(Object value) throws HibernateException { return ( (Calendar) value ).clone(); } - /** - * @see net.sf.hibernate.type.Type#returnedClass() - */ public Class getReturnedClass() { return Calendar.class; } - /** - * @see net.sf.hibernate.type.Type#equals(Object, Object) - */ public boolean equals(Object x, Object y) throws HibernateException { if (x==y) return true; --- 45,56 ---- *************** *** 88,94 **** } - /** - * @see net.sf.hibernate.type.Type#getName() - */ public String getName() { return "calendar_date"; --- 65,68 ---- Index: CalendarType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/CalendarType.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CalendarType.java 19 Jan 2003 11:47:08 -0000 1.4 --- CalendarType.java 26 Jan 2003 02:37:02 -0000 1.5 *************** *** 17,25 **** public class CalendarType extends MutableType { ! /** ! * @see net.sf.hibernate.type.NullableType#get(ResultSet, String) ! */ ! public Object get(ResultSet rs, String name) ! throws HibernateException, SQLException { Timestamp ts = rs.getTimestamp(name); --- 17,21 ---- public class CalendarType extends MutableType { ! public Object get(ResultSet rs, String name) throws HibernateException, SQLException { Timestamp ts = rs.getTimestamp(name); *************** *** 35,57 **** } ! /** ! * @see net.sf.hibernate.type.NullableType#set(PreparedStatement, Object, int) ! */ ! public void set(PreparedStatement st, Object value, int index) ! throws HibernateException, SQLException { st.setTimestamp( index, new Timestamp( ( (Calendar) value ).getTime().getTime() ) ); } - /** - * @see net.sf.hibernate.type.NullableType#sqlType() - */ public int sqlType() { return Types.TIMESTAMP; } - /** - * @see net.sf.hibernate.type.NullableType#toXML(Object) - */ public String toXML(Object value) throws HibernateException { //TODO: --- 31,43 ---- } ! public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { st.setTimestamp( index, new Timestamp( ( (Calendar) value ).getTime().getTime() ) ); } public int sqlType() { return Types.TIMESTAMP; } public String toXML(Object value) throws HibernateException { //TODO: *************** *** 59,79 **** } - /** - * @see net.sf.hibernate.type.NullableType#deepCopyNotNull(Object) - */ public Object deepCopyNotNull(Object value) throws HibernateException { return ( (Calendar) value ).clone(); } - /** - * @see net.sf.hibernate.type.Type#returnedClass() - */ public Class getReturnedClass() { return Calendar.class; } - /** - * @see net.sf.hibernate.type.Type#equals(Object, Object) - */ public boolean equals(Object x, Object y) throws HibernateException { if (x==y) return true; --- 45,56 ---- *************** *** 92,98 **** } - /** - * @see net.sf.hibernate.type.Type#getName() - */ public String getName() { return "calendar"; --- 69,72 ---- Index: TimeZoneType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/TimeZoneType.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TimeZoneType.java 19 Jan 2003 11:47:08 -0000 1.4 --- TimeZoneType.java 26 Jan 2003 02:37:02 -0000 1.5 *************** *** 18,24 **** public class TimeZoneType extends ImmutableType implements LiteralType { - /** - * @see net.sf.hibernate.type.NullableType#get(ResultSet, String) - */ public Object get(ResultSet rs, String name) throws HibernateException, SQLException { --- 18,21 ---- *************** *** 27,76 **** } ! /** ! * @see net.sf.hibernate.type.NullableType#set(PreparedStatement, Object, int) ! */ ! public void set(PreparedStatement st, Object value, int index) ! throws HibernateException, SQLException { Hibernate.STRING.set(st, ( (TimeZone) value ).getID(), index); } - /** - * @see net.sf.hibernate.type.NullableType#sqlType() - */ public int sqlType() { return Hibernate.STRING.sqlType(); } - /** - * @see net.sf.hibernate.type.NullableType#toXML(Object) - */ public String toXML(Object value) throws HibernateException { return ( (TimeZone) value ).getID(); } - /** - * @see net.sf.hibernate.type.Type#returnedClass() - */ public Class getReturnedClass() { return TimeZone.class; } - /** - * @see net.sf.hibernate.type.Type#equals(Object, Object) - */ public boolean equals(Object x, Object y) throws HibernateException { return ObjectUtils.equals(x, y); } - /** - * @see net.sf.hibernate.type.Type#getName() - */ public String getName() { return "timezone"; } - /** - * @see net.sf.hibernate.type.LiteralType#objectToSQLString(Object) - */ public String objectToSQLString(Object value) throws Exception { return ( (LiteralType) Hibernate.STRING ).objectToSQLString( --- 24,52 ---- } ! ! public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { Hibernate.STRING.set(st, ( (TimeZone) value ).getID(), index); } public int sqlType() { return Hibernate.STRING.sqlType(); } public String toXML(Object value) throws HibernateException { return ( (TimeZone) value ).getID(); } public Class getReturnedClass() { return TimeZone.class; } public boolean equals(Object x, Object y) throws HibernateException { return ObjectUtils.equals(x, y); } public String getName() { return "timezone"; } public String objectToSQLString(Object value) throws Exception { return ( (LiteralType) Hibernate.STRING ).objectToSQLString( |
From: <one...@us...> - 2003-01-26 02:37:05
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv30323/sf/hibernate Modified Files: hibernate-configuration.dtd Log Message: javadoc for Configuration Index: hibernate-configuration.dtd =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-configuration.dtd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hibernate-configuration.dtd 26 Jan 2003 01:33:34 -0000 1.2 --- hibernate-configuration.dtd 26 Jan 2003 02:37:02 -0000 1.3 *************** *** 11,14 **** --- 11,16 ---- --> + <ELEMENT hibernate-configuration (session-factory)> + <!ELEMENT property (#PCDATA)> <!ATTLIST property name CDATA #REQUIRED> |
From: <one...@us...> - 2003-01-26 02:37:05
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg In directory sc8-pr-cvs1:/tmp/cvs-serv30323/sf/hibernate/cfg Modified Files: Configuration.java Log Message: javadoc for Configuration Index: Configuration.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg/Configuration.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Configuration.java 26 Jan 2003 01:33:34 -0000 1.4 --- Configuration.java 26 Jan 2003 02:37:02 -0000 1.5 *************** *** 45,51 **** /** ! * NOT threadsafe */ - public class Configuration implements Mapping { --- 45,63 ---- /** ! * An instance of <tt>Configuration</tt> allows the application ! * to specify properties and mapping documents to be used when ! * creating a <tt>SessionFactory</tt>. Usually an application will create ! * a single <tt>Configuration</tt>, build a single instance of ! * <tt>SessionFactory</tt> and then instantiate <tt>Session</tt>s in ! * threads servicing client requests. The <tt>Configuration</tt> is meant ! * only as an initialization-time object. <tt>SessionFactory</tt>s are ! * immutable and do not retain any association back to the ! * <tt>Configuration</tt>.<br> ! * <br> ! * A new <tt>Configuration</tt> will use the properties specified in ! * <tt>hibernate.properties</tt> by default. ! * ! * @see net.sf.hibernate.SessionFactory */ public class Configuration implements Mapping { *************** *** 59,82 **** --- 71,113 ---- private static Log log = LogFactory.getLog(Configuration.class); + /** + * Returns the identifier type of a mapped class + */ public Type getIdentifierType(Class persistentClass) throws MappingException { return ( (PersistentClass) classes.get(persistentClass) ).getIdentifier().getType(); } + /** + * Iterate the class mappings + */ public Iterator getClassMappings() { return classes.values().iterator(); } + /** + * Iterate the collection mappings + */ public Iterator getCollectionMappings() { return collections.values().iterator(); } + /** + * Iterate the table mappings + */ private Iterator getTableMappings() { return tables.values().iterator(); } + /** + * Get the mapping for a particular class + */ public PersistentClass getClassMapping(Class persistentClass) { return (PersistentClass) classes.get(persistentClass); } + /** + * Read mappings from a particular XML file + * @param xmlFile a path to a file + */ public Configuration addFile(String xmlFile) throws MappingException { log.info("Mapping file: " + xmlFile); *************** *** 91,94 **** --- 122,129 ---- } + /** + * Read mappings from a <tt>String</tt> + * @param xml an XML string + */ public Configuration addXML(String xml) throws MappingException { if ( log.isDebugEnabled() ) log.debug("Mapping XML:\n" + xml); *************** *** 103,106 **** --- 138,145 ---- } + /** + * Read mappings from a DOM <tt>Document</tt> + * @param doc a DOM document + */ public Configuration addDocument(Document doc) throws MappingException { if ( log.isDebugEnabled() ) log.debug("Mapping XML:\n" + doc); *************** *** 125,128 **** --- 164,171 ---- } + /** + * Read mappings from an <tt>InputStream</tt> + * @param xmlInputStream an <tt>InputStream</tt> containing XML + */ public Configuration addInputStream(InputStream xmlInputStream) throws MappingException { try { *************** *** 139,142 **** --- 182,190 ---- } + /** + * Read mappings from an application resource + * @param path a resource + * @param classLoader a <tt>ClassLoader</tt> to use + */ public Configuration addResource(String path, ClassLoader classLoader) throws MappingException { log.info("Mapping resource: " + path); *************** *** 146,149 **** --- 194,202 ---- } + /** + * Read a mapping from an application resource, using a convention. + * The class <tt>foo.bar.Foo</tt> is mapped by the file <tt>foo/bar/Foo.hbm.xml</tt>. + * @param persistentClass the mapped class + */ public Configuration addClass(Class persistentClass) throws MappingException { String fileName = persistentClass.getName().replace(StringHelper.DOT,'/') + ".hbm.xml"; *************** *** 154,157 **** --- 207,214 ---- } + /** + * Read all mappings from a jar file + * @param resource an application resource (a jar file) + */ public Configuration addJar(String resource) throws MappingException { *************** *** 207,210 **** --- 264,270 ---- } + /** + * Generate DDL for dropping tables + */ public String[] generateDropSchemaScript(Dialect dialect) throws HibernateException { *************** *** 241,244 **** --- 301,307 ---- } + /** + * Generate DDL for creating tables + */ public String[] generateSchemaCreationScript(Dialect dialect) throws HibernateException { secondPassCompile(); *************** *** 282,285 **** --- 345,351 ---- } + /** + * Generate DDL for altering tables + */ public String[] generateSchemaUpdateScript(Dialect dialect, JdbcDatabaseInfo databaseInfo) throws HibernateException { secondPassCompile(); *************** *** 365,368 **** --- 431,437 ---- } + /** + * Get the named queries + */ public Map getNamedQueries() { return namedQueries; *************** *** 426,429 **** --- 495,507 ---- } + /** + * Instantiate a new <tt>SessionFactory</tt>, using the properties and + * mappings in this configuration. The <tt>SessionFactory</tt> will be + * immutable, so changes made to the <tt>Configuration</tt> after + * building the <tt>SessionFactory</tt> will not affect it. + * + * @see net.sf.hibernate.SessionFactory + * @return a new factory for <tt>Session</tt>s + */ public SessionFactory buildSessionFactory() throws HibernateException { secondPassCompile(); *************** *** 434,457 **** } public Interceptor getInterceptor() { return interceptor; } ! public Properties getProperties() { return properties; } ! public void setInterceptor(Interceptor interceptor) { this.interceptor = interceptor; } ! public void setProperties(Properties properties) { this.properties = properties; } public void setProperty(String propertyName, String value) { properties.setProperty(propertyName, value); } public String getProperty(String propertyName) { return properties.getProperty(propertyName); --- 512,555 ---- } + /** + * Return the configured <tt>Interceptor</tt> + */ public Interceptor getInterceptor() { return interceptor; } ! ! /** ! * Get all properties ! */ public Properties getProperties() { return properties; } ! /** ! * Configure an <tt>Interceptor</tt> ! */ ! public Configuration setInterceptor(Interceptor interceptor) { this.interceptor = interceptor; + return this; } ! /** ! * Specify a completely new set of properties ! */ ! public Configuration setProperties(Properties properties) { this.properties = properties; + return this; } + /** + * Set a property + */ public void setProperty(String propertyName, String value) { properties.setProperty(propertyName, value); } + /** + * Get a property + */ public String getProperty(String propertyName) { return properties.getProperty(propertyName); *************** *** 491,499 **** } ! public void configure() throws HibernateException { configure("hibernate.cfg.xml"); } ! public void configure(String resource) throws HibernateException { InputStream stream = getConfigurationInputStream(resource); --- 589,607 ---- } ! /** ! * Use the mappings and properties specified in an application ! * resource named <tt>hibernate.cfg.xml</tt>. ! */ ! public Configuration configure() throws HibernateException { configure("hibernate.cfg.xml"); + return this; } ! /** ! * Use the mappings and properties specified in the given application ! * resource. The format of the resource is defined in ! * <tt>hibernate-configuration.dtd</tt>. ! */ ! public Configuration configure(String resource) throws HibernateException { InputStream stream = getConfigurationInputStream(resource); *************** *** 546,549 **** --- 654,659 ---- log.info("Configured SessionFactory: " + name); log.debug("properties: " + properties); + + return this; } |
From: <one...@us...> - 2003-01-26 01:34:09
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/cfg Modified Files: Configuration.java Added Files: Environment.java Removed Files: Datastore.java Log Message: redesigned configuration API --- NEW FILE: Environment.java --- //$Id: Environment.java,v 1.1 2003/01/26 01:33:34 oneovthafew Exp $ package net.sf.hibernate.cfg; import java.io.InputStream; import java.sql.Connection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import net.sf.hibernate.util.PropertiesHelper; /** * Provides access to configuration info passed in <tt>Properties</tt> objects.<br> * <br> * Hibernate has two property scopes: * <ul> * <li><b>Factory-level</b> properties may be passed to the <tt>SessionFactory</tt> when it * instantiated. Each instance might have different property values. If no * properties are specified, the factory calls <tt>Environment.getProperties()</tt>. * <li><b>System-level</b> properties are shared by all factory instances and are always * determined by the <tt>Environment</tt> properties. * </ul> * The only system-level property is * <ul> * <li><tt>hibernate.jdbc.use_streams_for_binary</tt> * </ul> * <tt>Environment</tt> properties are populated by calling <tt>System.getProperties()</tt> * and then from a resource named <tt>/hibernate.properties</tt> if it exists. System * properties override properties specified in <tt>hibernate.properties</tt>. * * @see SessionFactory */ public final class Environment { private static final String VERSION = "2.0 beta 1"; /** * <tt>ConnectionProvider</tt> implementor to use when obtaining connections */ public static final String CONNECTION_PROVIDER ="hibernate.connection.provider_class"; /** * JDBC driver class */ public static final String DRIVER ="hibernate.connection.driver_class"; /** * JDBC transaction isolation level */ public static final String ISOLATION ="hibernate.connection.isolation"; /** * JDBC URL */ public static final String URL ="hibernate.connection.url"; /** * JDBC user */ public static final String USER ="hibernate.connection.username"; /** * JDBC password */ public static final String PASS ="hibernate.connection.password"; /** * Maximum number of inactive connections for Hibernate's connection pool */ public static final String POOL_SIZE ="hibernate.connection.pool_size"; /** * <tt>java.sql.Datasource</tt> JNDI name */ public static final String DATASOURCE ="hibernate.connection.datasource"; /** * prefix for arbitrary JDBC connection properties */ 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> */ public static final String JNDI_CLASS ="hibernate.jndi.class"; /** * JNDI provider URL, <tt>Context.PROVIDER_URL</tt> */ public static final String JNDI_URL ="hibernate.jndi.url"; /** * prefix for arbitrary JNDI <tt>InitialContext</tt> properties */ public static final String JNDI_PREFIX = "hibernate.jndi"; /** * JNDI name to bind to <tt>SessionFactory</tt> */ public static final String SESSION_FACTORY_NAME = "hibernate.session_factory_name"; /** * Hibernate SQL <tt>Dialect</tt> class */ public static final String DIALECT ="hibernate.dialect"; /** * A default database schema (owner) name to use for unqualified tablenames */ public static final String DEFAULT_SCHEMA = "hibernate.default_schema"; /** * Enable logging of generated SQL to the console */ public static final String SHOW_SQL ="hibernate.show_sql"; /** * Enable deep fetching using outerjoins */ public static final String OUTER_JOIN ="hibernate.use_outer_join"; /** * Use <tt>java.io</tt> streams to read / write binary data from / to JDBC */ public static final String USE_STREAMS_FOR_BINARY = "hibernate.jdbc.use_streams_for_binary"; /** * Use JDBC scrollable <tt>ResultSet</tt>s. This property is only necessary when there is * no <tt>ConnectionProvider</tt>, ie. the user is supplying JDBC connections. */ 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 */ public static final String C3P0_MAX_SIZE = "hibernate.c3p0.max_size"; /** * Minimum size of C3P0 connection pool */ public static final String C3P0_MIN_SIZE = "hibernate.c3p0.min_size"; /** * Maximum idle time for C3P0 connection pool */ public static final String C3P0_TIMEOUT = "hibernate.c3p0.timeout"; /** * Maximum size of C3P0 statement cache */ public static final String C3P0_MAX_STATEMENTS = "hibernate.c3p0.max_statements"; /** * Should we validate the connection on checkout? (optional) */ public static final String C3P0_VALIDATE_CONNECTION = "hibernate.c3p0.validate"; /** * Maximum number of checked out connections for DBCP connection pool */ public static final String DBCP_MAXACTIVE = "hibernate.dbcp.maxActive"; /** * Maximum number of idle connections for DBCP connection pool */ public static final String DBCP_MAXIDLE = "hibernate.dbcp.maxIdle"; /** * Maximum idle time for connections in DBCP connection pool (ms) */ public static final String DBCP_MAXWAIT = "hibernate.dbcp.maxWait"; /** * Action to take in case of an exhausted DBCP connection pool ( 0 = fail, 1 = block, 2= grow) */ public static final String DBCP_WHENEXHAUSTED = "hibernate.dbcp.whenExhaustedAction"; /** * Query to execute for connection validation (optional) */ public static final String DBCP_VALIDATION_QUERY = "hibernate.dbcp.validationQuery"; /** * Maximum number of checked out statements for DBCP */ public static final String DBCP_PS_MAXACTIVE = "hibernate.dbcp.ps.maxActive"; /** * Maximum number of idle statements for DBCP */ public static final String DBCP_PS_MAXIDLE = "hibernate.dbcp.ps.maxIdle"; /** * Maximum idle time for statements in DBCP (ms) */ public static final String DBCP_PS_MAXWAIT = "hibernate.dbcp.ps.maxWait"; /** * Action to take in case of an exhausted DBCP statement pool ( 0 = fail, 1 = block, 2= grow) */ public static final String DBCP_PS_WHENEXHAUSTED = "hibernate.dbcp.ps.whenExhaustedAction"; /** * <tt>TransactionFactory</tt> implementor to use for creating <tt>Transaction</tt>s */ public static final String TRANSACTION_STRATEGY = "hibernate.transaction.factory_class"; /** * <tt>TransactionManagerLookup</tt> implementor to use for obtaining the <tt>TransactionManager</tt> */ public static final String TRANSACTION_MANAGER_STRATEGY = "hibernate.transaction.manager_lookup_class"; /** * JNDI name of JTA <tt>UserTransaction</tt> object */ public static final String USER_TRANSACTION = "jta.UserTransaction"; /** * A comma-seperated list of token substitutions to use when translating a Hibernate * query to SQL */ public static final String QUERY_SUBSTITUTIONS = "hibernate.query.substitutions"; /** * A comma-seperated list of packages that need not be specified in a query */ 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"; private static final String DRIVER_OLD ="hibernate.driver"; private static final String ISOLATION_OLD ="hibernate.isolation"; private static final String USER_OLD ="hibernate.username"; private static final String PASS_OLD ="hibernate.password"; private static final String POOL_SIZE_OLD ="hibernate.pool_size"; private static final String STATEMENT_CACHE_SIZE_OLD ="hibernate.statement_cache_size"; private static final String DATASOURCE_OLD ="hibernate.datasource"; private static final String TRANSACTION_STRATEGY_OLD = "hibernate.transaction_factory"; 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"; /** * Use JDBC2 batch updates * @deprecated */ 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. */ public static void verifyProperties(Properties props) { Iterator iter = props.keySet().iterator(); while ( iter.hasNext() ) { Object oldProp = iter.next(); Object newProp = obsoleteProperties.get(oldProp); if ( newProp!=null ) log.warn("Usage of obsolete property: " + oldProp + " no longer supported, use: " + newProp); } } static { log.info("Hibernate " + VERSION); isolationLevels.put( new Integer(Connection.TRANSACTION_NONE), "NONE" ); isolationLevels.put( new Integer(Connection.TRANSACTION_READ_UNCOMMITTED), "READ_UNCOMMITTED" ); isolationLevels.put( new Integer(Connection.TRANSACTION_READ_COMMITTED), "READ_COMMITTED" ); 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); obsoleteProperties.put(ISOLATION_OLD, ISOLATION); obsoleteProperties.put(URL_OLD, URL); obsoleteProperties.put(PASS_OLD, PASS); obsoleteProperties.put(USER_OLD, USER); obsoleteProperties.put(POOL_SIZE_OLD, POOL_SIZE); obsoleteProperties.put(STATEMENT_CACHE_SIZE_OLD, STATEMENT_CACHE_SIZE); obsoleteProperties.put(DATASOURCE_OLD, DATASOURCE); obsoleteProperties.put(TRANSACTION_STRATEGY_OLD, TRANSACTION_STRATEGY); obsoleteProperties.put(OUTPUT_STYLESHEET_OLD, OUTPUT_STYLESHEET); obsoleteProperties.put(USE_JDBC_BATCH, STATEMENT_BATCH_SIZE); obsoleteProperties.put(USE_SCROLLABLE_RESULTSET_OLD, USE_SCROLLABLE_RESULTSET); 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 ) { log.info("hibernate.properties not found"); } else { try { properties.load(stream); log.info("loaded properties from resource hibernate.properties"); } catch (Exception e) { log.error("problem loading properties from hibernate.properties"); } } 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 { Class.forName("java.lang.reflect.Proxy"); proxySupport = true; } catch (ClassNotFoundException cnfe) { proxySupport = false; } log.info("JVM proxy support: " + proxySupport); jvmSupportsProxies = proxySupport; boolean linkedHashSupport; try { Class.forName("java.util.LinkedHashSet"); linkedHashSupport = true; } catch (ClassNotFoundException cnfe) { linkedHashSupport = false; } 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 * in <tt>hibernate.properties</tt>. * @return Properties */ public static Properties getProperties() { Properties copy = new Properties(); copy.putAll(properties); return copy; } /** * Get the name of a JDBC transaction isolation level * * @see java.sql.Connection * @param isolation as defined by <tt>java.sql.Connection</tt> * @return String */ public static String isolationLevelToString(int isolation) { return (String) isolationLevels.get( new Integer(isolation) ); } } Index: Configuration.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg/Configuration.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Configuration.java 5 Jan 2003 02:11:20 -0000 1.3 --- Configuration.java 26 Jan 2003 01:33:34 -0000 1.4 *************** *** 2,93 **** package net.sf.hibernate.cfg; import java.io.InputStream; ! import java.util.*; ! import net.sf.hibernate.*; ! import net.sf.hibernate.util.XMLHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.w3c.dom.*; ! import org.xml.sax.*; /** ! * Parses an XML configuration file like ! * ! * <pre> ! * <?xml version='1.0' encoding='utf-8'?> ! * <!DOCTYPE hibernate-configuration PUBLIC ! * "-//Hibernate/Hibernate Configuration DTD//EN" ! * "http://hibernate.sourceforge.net/hibernate-configuration.dtd"> ! * ! * <hibernate-configuration> ! * ! * <property name="show_sql">false</property> ! * <property name="use_outer_join">true</property> ! * <property name="jta.UserTransaction">java:comp/UserTransaction/</property> ! * ! * <session-factory name="/jndi/name"> ! * <property name="connection.datasource">my/first/datasource</property> ! * <property name="dialect">net.sf.hibernate.sql.MySQLDialect</property> ! * <mapping resource="eg/Foo.hbm.xml"/> ! * <mapping resource="eg/Bar.hbm.xml"/> ! * </session-factory> ! * ! * <session-factory name="/another/jndi/name"> ! * <property name="connection.datasource">my/other/datasource</property> ! * <property name="dialect">net.sf.hibernate.sql.OracleDialect</property> ! * <mapping file="C:/mapping/my_mappings.hbm.xml"/> ! * <mapping jar="deployed.jar"/> ! * </session-factory> ! * ! * </hibernate-configuration> ! * </pre> ! * ! * and builds one or more <tt>SessionFactory</tt> instances. The top-level <tt><property> ! * </tt> declarations apply to all instances. Elements nested inside the <tt><session-factory> ! * </tt> tag apply only to that particular instance. The "<tt>hibernate.</tt>" prefix may be ! * omitted from property names. The <tt>name</tt> attribute of <tt><session-factory></tt> ! * is equivalent to the property <tt>hibernate.session_factory_name</tt>.<br> ! * <br> ! * Typical usage is for J2EE applications to place <tt>hibernate.cfg.xml</tt> in the ! * classpath and call <tt>Hibernate.configure()</tt>. ! * ! * @see Hibernate#configure() */ ! public class Configuration { ! private Log log = LogFactory.getLog(Configuration.class); ! private String resource; ! /** ! * For use by subclasses which override <tt>getConfigurationInputStream()</tt> ! */ ! protected Configuration() { } ! public Configuration(String resource) { ! this.resource = resource; } ! /** ! * Get the configuration file as an <tt>InputStream</tt>. Might be overridden ! * by subclasses to allow the configuration to be located by some arbitrary ! * mechanism. ! */ ! protected InputStream getConfigurationInputStream() throws HibernateException { ! log.info("Configuration resource: " + resource); ! InputStream stream = Environment.class.getResourceAsStream(resource); ! if (stream==null) { ! log.warn(resource + " not found"); ! throw new HibernateException(resource + " not found"); } - return stream; } ! private void addProperties(Node parent, Properties properties) { NodeList children = parent.getChildNodes(); for ( int i=0; i<children.getLength(); i++ ) { --- 2,462 ---- package net.sf.hibernate.cfg; + import java.util.Enumeration; + import java.util.Iterator; + import java.util.ArrayList; + import java.util.HashMap; + import java.util.Map; + import java.util.Properties; + import java.util.jar.JarFile; + import java.util.zip.ZipEntry; + import java.io.IOException; import java.io.InputStream; ! import java.io.Serializable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.w3c.dom.Document; ! import org.w3c.dom.NamedNodeMap; ! import org.w3c.dom.Node; ! import org.w3c.dom.NodeList; ! import org.xml.sax.InputSource; ! ! import net.sf.hibernate.util.ArrayHelper; ! import net.sf.hibernate.util.StringHelper; ! import net.sf.hibernate.util.XMLHelper; ! import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.Interceptor; ! import net.sf.hibernate.MappingException; ! import net.sf.hibernate.SessionFactory; ! import net.sf.hibernate.tool.hbm2ddl.JdbcDatabaseInfo; ! import net.sf.hibernate.tool.hbm2ddl.JdbcTableInfo; ! import net.sf.hibernate.type.Type; ! import net.sf.hibernate.id.IdentifierGenerator; ! import net.sf.hibernate.id.PersistentIdentifierGenerator; ! import net.sf.hibernate.impl.SessionFactoryImpl; ! import net.sf.hibernate.mapping.Collection; ! import net.sf.hibernate.mapping.ForeignKey; ! import net.sf.hibernate.mapping.Index; ! import net.sf.hibernate.mapping.PersistentClass; ! import net.sf.hibernate.mapping.Root; ! import net.sf.hibernate.mapping.Table; ! import net.sf.hibernate.dialect.Dialect; ! import net.sf.hibernate.engine.Mapping; /** ! * NOT threadsafe */ ! ! public class Configuration implements Mapping { ! private HashMap classes = new HashMap(); ! private HashMap collections = new HashMap(); ! private HashMap tables = new HashMap(); ! private HashMap namedQueries = new HashMap(); ! private Interceptor interceptor = EMPTY_INTERCEPTOR; ! private Properties properties = Environment.getProperties(); ! private static Log log = LogFactory.getLog(Configuration.class); ! public Type getIdentifierType(Class persistentClass) throws MappingException { ! return ( (PersistentClass) classes.get(persistentClass) ).getIdentifier().getType(); } ! public Iterator getClassMappings() { ! return classes.values().iterator(); } ! public Iterator getCollectionMappings() { ! return collections.values().iterator(); ! } ! ! private Iterator getTableMappings() { ! return tables.values().iterator(); ! } ! ! public PersistentClass getClassMapping(Class persistentClass) { ! return (PersistentClass) classes.get(persistentClass); ! } ! ! public Configuration addFile(String xmlFile) throws MappingException { ! log.info("Mapping file: " + xmlFile); ! try { ! add( XMLHelper.parseFile(xmlFile) ); ! } ! catch (Exception e) { ! log.error("Could not configure datastore from file: " + xmlFile, e); ! throw new MappingException(e); ! } ! return this; ! } ! ! public Configuration addXML(String xml) throws MappingException { ! if ( log.isDebugEnabled() ) log.debug("Mapping XML:\n" + xml); ! try { ! add( XMLHelper.parseString(xml) ); ! } ! catch (Exception e) { ! log.error("Could not configure datastore from XML", e); ! throw new MappingException(e); ! } ! return this; ! } ! ! public Configuration addDocument(Document doc) throws MappingException { ! if ( log.isDebugEnabled() ) log.debug("Mapping XML:\n" + doc); ! try { ! add(doc); ! } ! catch (Exception e) { ! log.error("Could not configure datastore from XML document", e); ! throw new MappingException(e); ! } ! return this; ! } ! ! private void add(Document doc) throws Exception { ! try { ! new Root(doc, classes, collections, tables, namedQueries); ! } ! catch (MappingException me) { ! log.error("Could not compile the mapping document", me); ! throw me; ! } ! } ! ! public Configuration addInputStream(InputStream xmlInputStream) throws MappingException { ! try { ! add( XMLHelper.parseInputSource( new InputSource(xmlInputStream) ) ); ! return this; ! } ! catch (MappingException me) { ! throw me; ! } ! catch (Exception e) { ! log.error("Could not configure datastore from input stream", e); ! throw new MappingException(e); ! } ! } ! ! public Configuration addResource(String path, ClassLoader classLoader) throws MappingException { ! log.info("Mapping resource: " + path); ! InputStream rsrc = classLoader.getResourceAsStream(path); ! if (rsrc==null) throw new MappingException("Resource: " + path + " not found"); ! return addInputStream(rsrc); ! } ! ! public Configuration addClass(Class persistentClass) throws MappingException { ! String fileName = persistentClass.getName().replace(StringHelper.DOT,'/') + ".hbm.xml"; ! log.info("Mapping resource: " + fileName); ! InputStream rsrc = persistentClass.getClassLoader().getResourceAsStream(fileName); ! if (rsrc==null) throw new MappingException("Resource: " + fileName + " not found"); ! return addInputStream(rsrc); ! } ! ! public Configuration addJar(String resource) throws MappingException { ! log.info("Searching for mapping documents in jar: " + resource); ! final JarFile jarFile; ! try { ! jarFile = new JarFile( ! Thread.currentThread().getContextClassLoader().getResource(resource).getFile() ! ); ! } ! catch (IOException ioe) { ! log.error("Could not configure datastore from jar", ioe); ! throw new MappingException(ioe); ! } ! ! if (jarFile==null) throw new MappingException("Resource: " + resource + " not found"); ! ! Enumeration enum = jarFile.entries(); ! while( enum.hasMoreElements() ) { ! ! ZipEntry z = (ZipEntry) enum.nextElement(); ! ! if( z.getName().endsWith(".hbm.xml") ) { ! log.info( "Found mapping documents in jar: " + z.getName() ); ! try { ! addInputStream( jarFile.getInputStream(z) ); ! } ! catch (MappingException me) { ! throw me; ! } ! catch (Exception e) { ! log.error("Could not configure datastore from jar", e); ! throw new MappingException(e); ! } ! } } + return this; + + } + + private Iterator iterateGenerators(Dialect dialect) throws MappingException { + HashMap generators = new HashMap(); + Iterator iter = classes.values().iterator(); + while ( iter.hasNext() ) { + IdentifierGenerator ig = ( (PersistentClass) iter.next() ).getIdentifier().createIdentifierGenerator(dialect); + if ( ig instanceof PersistentIdentifierGenerator ) generators.put( + ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig + ); + } + return generators.values().iterator(); } ! public String[] generateDropSchemaScript(Dialect dialect) throws HibernateException { ! ! secondPassCompile(); ! ! ArrayList script = new ArrayList(50); ! ! if ( dialect.dropConstraints() ) { ! Iterator iter = getTableMappings(); ! while ( iter.hasNext() ) { ! Table table = (Table)iter.next(); ! Iterator subIter = table.foreignKeyIterator(); ! while ( subIter.hasNext() ) { ! ForeignKey fk = (ForeignKey)subIter.next(); ! script.add(fk.sqlDropString(dialect)); ! } ! } ! } ! ! ! Iterator iter = getTableMappings(); ! while ( iter.hasNext() ) { ! Table table = (Table) iter.next(); ! script.add( table.sqlDropString(dialect) ); ! } ! ! iter = iterateGenerators(dialect); ! while ( iter.hasNext() ) { ! String dropString = ( (PersistentIdentifierGenerator) iter.next() ).sqlDropString(dialect); ! if (dropString!=null) script.add(dropString); ! } ! ! return ArrayHelper.toStringArray(script); ! } ! ! public String[] generateSchemaCreationScript(Dialect dialect) throws HibernateException { ! secondPassCompile(); ! ! ArrayList script = new ArrayList(50); ! ! Iterator iter = getTableMappings(); ! while ( iter.hasNext() ) { ! Table table = (Table) iter.next(); ! script.add( table.sqlCreateString(dialect, this) ); ! } ! ! iter = getTableMappings(); ! while ( iter.hasNext() ) { ! Table table = (Table) iter.next(); ! Iterator subIter; ! ! if ( dialect.hasAlterTable() ) { ! subIter = table.foreignKeyIterator(); ! while ( subIter.hasNext() ) { ! ForeignKey fk = (ForeignKey) subIter.next(); ! script.add( fk.sqlCreateString(dialect, this) ); ! } ! } ! ! subIter = table.indexIterator(); ! while ( subIter.hasNext() ) { ! Index index = (Index) subIter.next(); ! script.add( index.sqlCreateString(dialect, this) ); ! } ! } ! ! iter = iterateGenerators(dialect); ! while ( iter.hasNext() ) ! { ! String[] lines = ( (PersistentIdentifierGenerator) iter.next() ).sqlCreateStrings(dialect); ! for ( int i=0; i<lines.length; i++ ) script.add( lines[i] ); ! } ! ! return ArrayHelper.toStringArray(script); ! } ! ! public String[] generateSchemaUpdateScript(Dialect dialect, JdbcDatabaseInfo databaseInfo) throws HibernateException { ! secondPassCompile(); ! ! ArrayList script = new ArrayList(50); ! ! Iterator iter = getTableMappings(); ! while ( iter.hasNext() ) { ! Table table = (Table) iter.next(); ! JdbcTableInfo tableInfo = databaseInfo.getTableInfo( table.getName() ); ! if (tableInfo == null) { ! script.add( table.sqlCreateString(dialect, this) ); ! } ! else { ! final String sql = table.sqlAlterString(dialect, this, tableInfo); ! if (sql!=null) script.add(sql); ! } ! } ! ! iter = getTableMappings(); ! while ( iter.hasNext() ) { ! Table table = (Table) iter.next(); ! JdbcTableInfo tableInfo = databaseInfo.getTableInfo( table.getName() ); ! Iterator subIter; ! ! if ( dialect.hasAlterTable() ) { ! subIter = table.foreignKeyIterator(); ! while (subIter.hasNext()) { ! ForeignKey fk = (ForeignKey) subIter.next(); ! if ( tableInfo == null || tableInfo.getForeignKeyInfo( fk.getName() ) == null ) ! script.add( fk.sqlCreateString(dialect, this) ); ! } ! } ! ! subIter = table.indexIterator(); ! while ( subIter.hasNext() ) { ! Index index = (Index)subIter.next(); ! if ( tableInfo == null || tableInfo.getIndexInfo( index.getName() )==null ) ! script.add( index.sqlCreateString(dialect, this) ); ! } ! } ! ! iter = iterateGenerators(dialect); ! while ( iter.hasNext() ) { ! PersistentIdentifierGenerator generator = (PersistentIdentifierGenerator) iter.next(); ! Object key = generator.generatorKey(); ! if ( !databaseInfo.isSequence(key) && !databaseInfo.isTable(key) ) { ! String[] lines = generator.sqlCreateStrings(dialect); ! for (int i = 0; i < lines.length; i++) script.add( lines[i] ); ! } ! } ! ! return ArrayHelper.toStringArray(script); ! } ! ! // This method may be called many times!! ! private void secondPassCompile() throws MappingException { ! ! Iterator iter = collections.values().iterator(); ! while ( iter.hasNext() ) { ! ( (Collection) iter.next() ).secondPassCompile(classes); ! } ! ! //TODO: Somehow add the newly created foreign keys to the internal collection ! ! iter = getTableMappings(); ! while ( iter.hasNext() ) { ! Table table = (Table) iter.next(); ! Iterator subIter = table.foreignKeyIterator(); ! while ( subIter.hasNext() ) { ! ! ForeignKey fk = (ForeignKey)subIter.next(); ! if ( fk.getReferencedTable() == null ) { ! PersistentClass referencedClass = (PersistentClass) classes.get( fk.getReferencedClass() ); ! if (referencedClass == null) throw new MappingException( ! "An association refers to an unmapped class: " + ! fk.getReferencedClass().getName() ! ); ! fk.setReferencedTable( referencedClass.getTable() ); ! } ! } ! } ! } ! ! public Map getNamedQueries() { ! return namedQueries; ! } ! ! private static final Interceptor EMPTY_INTERCEPTOR = new EmptyInterceptor(); ! ! public static final class EmptyInterceptor implements Interceptor, Serializable { ! /** ! * @see net.sf.hibernate.Interceptor#onDelete(Object, Serializable id, Object[], String[], Type[]) ! */ ! public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { ! } ! ! /** ! * @see net.sf.hibernate.Interceptor#onFlushDirty(Object, Object[], Object[], String[], Type[]) ! */ ! public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) { ! return false; ! } ! ! /** ! * @see net.sf.hibernate.Interceptor#onLoad(Object, Object[], String[], Type[]) ! */ ! public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { ! return false; ! } ! ! /** ! * @see net.sf.hibernate.Interceptor#onSave(Object, Object[], String[], Type[]) ! */ ! public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { ! return false; ! } ! ! /** ! * @see net.sf.hibernate.Interceptor#onPostFlush(Object, Serializable, Object[], String[], Type[]) ! */ ! public void onPostFlush(Object entity, Serializable id, Object[] currentState, String[] propertyNames, Type[] types) { ! } ! ! /** ! * @see net.sf.hibernate.Interceptor#postFlush(Iterator) ! */ ! public void postFlush(Iterator entities) { ! } ! ! /** ! * @see net.sf.hibernate.Interceptor#preFlush(Iterator) ! */ ! public void preFlush(Iterator entities) { ! } ! ! /** ! * @see net.sf.hibernate.Interceptor#isUnsaved(java.lang.Object) ! */ ! public Boolean isUnsaved(Object entity) { ! return null; ! } ! ! } ! ! public SessionFactory buildSessionFactory() throws HibernateException { ! secondPassCompile(); ! Environment.verifyProperties(properties); ! Properties copy = new Properties(); ! copy.putAll(properties); ! return new SessionFactoryImpl(this, copy, interceptor); ! } ! ! public Interceptor getInterceptor() { ! return interceptor; ! } ! ! public Properties getProperties() { ! return properties; ! } ! ! public void setInterceptor(Interceptor interceptor) { ! this.interceptor = interceptor; ! } ! ! public void setProperties(Properties properties) { ! this.properties = properties; ! } ! ! public void setProperty(String propertyName, String value) { ! properties.setProperty(propertyName, value); ! } ! ! public String getProperty(String propertyName) { ! return properties.getProperty(propertyName); ! } ! ! private void addProperties(Node parent) { NodeList children = parent.getChildNodes(); for ( int i=0; i<children.getLength(); i++ ) { *************** *** 102,112 **** } Environment.verifyProperties(properties); ! }; ! public SessionFactory[] configure() throws HibernateException { ! ArrayList factories = new ArrayList(); ! InputStream stream = getConfigurationInputStream(); Document doc; --- 471,501 ---- } Environment.verifyProperties(properties); ! } ! /** ! * Get the configuration file as an <tt>InputStream</tt>. Might be overridden ! * by subclasses to allow the configuration to be located by some arbitrary ! * mechanism. ! */ ! protected InputStream getConfigurationInputStream(String resource) throws HibernateException { ! log.info("Configuration resource: " + resource); ! InputStream stream = Environment.class.getResourceAsStream(resource); ! if (stream==null) { ! log.warn(resource + " not found"); ! throw new HibernateException(resource + " not found"); ! } ! return stream; ! ! } ! ! public void configure() throws HibernateException { ! configure("hibernate.cfg.xml"); ! } ! ! public void configure(String resource) throws HibernateException { ! ! InputStream stream = getConfigurationInputStream(resource); Document doc; *************** *** 118,174 **** throw new HibernateException( "Problem parsing configuration " + resource + ": " + e ); } - Properties topLevelProps = new Properties(); - topLevelProps.putAll( Environment.getProperties() ); - addProperties( doc.getDocumentElement(), topLevelProps ); ! NodeList sfElements = doc.getDocumentElement().getElementsByTagName("session-factory"); ! for ( int i=0; i<sfElements.getLength(); i++ ) { ! Node sfNode = sfElements.item(i); ! Properties props = (Properties) topLevelProps.clone(); ! String name = sfNode.getAttributes().getNamedItem("name").getNodeValue(); ! props.put(Environment.SESSION_FACTORY_NAME, name); ! addProperties(sfNode, props); ! ! Datastore ds = Hibernate.createDatastore(); ! ! NodeList mapElements = sfNode.getChildNodes(); ! for ( int j=0; j<mapElements.getLength(); j++ ) { ! Node mapElement = mapElements.item(j); ! if ( mapElement.getNodeName().equals("mapping") ) { ! NamedNodeMap atts = mapElement.getAttributes(); ! Node resource = atts.getNamedItem("resource"); ! Node file = atts.getNamedItem("file"); ! Node jar = atts.getNamedItem("jar"); ! if (resource!=null) { ! log.debug(name + "<-" + resource); ! try { ! ds.storeResource( resource.getNodeValue(), Thread.currentThread().getContextClassLoader() ); ! } ! catch (MappingException me) { ! ds.storeResource( resource.getNodeValue(), Environment.class.getClassLoader() ); ! } ! } ! else if ( jar!=null ) { ! log.debug(name + "<-" + jar); ! ds.storeJar( jar.getNodeValue() ); } ! else { ! if (file==null) throw new HibernateException("<mapping> element in configuration specifies no attributes"); ! log.debug(name + "<-" + file); ! ds.storeFile( file.getNodeValue() ); } } } - - factories.add( ds.buildSessionFactory(props) ); - - log.info("Configured SessionFactory: " + name); - log.debug("properties: " + props); } ! log.debug("Configuration successful"); - return (SessionFactory[]) factories.toArray( new SessionFactory[ factories.size() ] ); } } --- 507,552 ---- throw new HibernateException( "Problem parsing configuration " + resource + ": " + e ); } ! Node sfNode = doc.getDocumentElement(); ! String name = sfNode.getAttributes().getNamedItem("name").getNodeValue(); ! properties.setProperty(Environment.SESSION_FACTORY_NAME, name); ! addProperties(sfNode); ! ! Configuration ds = new Configuration(); ! ! NodeList mapElements = sfNode.getChildNodes(); ! for ( int j=0; j<mapElements.getLength(); j++ ) { ! Node mapElement = mapElements.item(j); ! if ( mapElement.getNodeName().equals("mapping") ) { ! NamedNodeMap atts = mapElement.getAttributes(); ! Node rsrc = atts.getNamedItem("resource"); ! Node file = atts.getNamedItem("file"); ! Node jar = atts.getNamedItem("jar"); ! if (rsrc!=null) { ! log.debug(name + "<-" + rsrc); ! try { ! ds.addResource( rsrc.getNodeValue(), Thread.currentThread().getContextClassLoader() ); } ! catch (MappingException me) { ! ds.addResource( rsrc.getNodeValue(), Environment.class.getClassLoader() ); } } + else if ( jar!=null ) { + log.debug(name + "<-" + jar); + ds.addJar( jar.getNodeValue() ); + } + else { + if (file==null) throw new HibernateException("<mapping> element in configuration specifies no attributes"); + log.debug(name + "<-" + file); + ds.addFile( file.getNodeValue() ); + } } } ! log.info("Configured SessionFactory: " + name); ! log.debug("properties: " + properties); } + } --- Datastore.java DELETED --- |
From: <one...@us...> - 2003-01-26 01:34:08
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/collection Modified Files: CollectionPersister.java Log Message: redesigned configuration API Index: CollectionPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/CollectionPersister.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CollectionPersister.java 20 Jan 2003 12:48:09 -0000 1.5 --- CollectionPersister.java 26 Jan 2003 01:33:34 -0000 1.6 *************** *** 15,21 **** 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; --- 15,21 ---- import net.sf.hibernate.cache.CacheConcurrencyStrategy; import net.sf.hibernate.cache.CacheException; + import net.sf.hibernate.cfg.Configuration; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.loader.CollectionInitializer; import net.sf.hibernate.loader.CollectionLoader; *************** *** 92,96 **** ! public CollectionPersister(Collection collection, DatastoreImpl datastore, SessionFactoryImplementor factory) throws MappingException, CacheException { collectionType = collection.getType(); --- 92,96 ---- ! public CollectionPersister(Collection collection, Configuration datastore, SessionFactoryImplementor factory) throws MappingException, CacheException { collectionType = collection.getType(); *************** *** 123,127 **** EntityType type = collection.getOneToMany().getType(); elementType = type; ! PersistentClass associatedClass = datastore.getPersistentClass( type.getPersistentClass() ); span = associatedClass.getIdentifier().getColumnSpan(); elementColumnNames = new String[span]; --- 123,127 ---- EntityType type = collection.getOneToMany().getType(); elementType = type; ! PersistentClass associatedClass = datastore.getClassMapping( type.getPersistentClass() ); span = associatedClass.getIdentifier().getColumnSpan(); elementColumnNames = new String[span]; |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate Modified Files: Databinder.java Hibernate.java Interceptor.java SessionFactory.java hibernate-configuration.dtd Removed Files: Environment.java Log Message: redesigned configuration API Index: Databinder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Databinder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Databinder.java 5 Jan 2003 02:11:19 -0000 1.3 --- Databinder.java 26 Jan 2003 01:33:34 -0000 1.4 *************** *** 7,11 **** /** ! * 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 --- 7,11 ---- /** ! * Provides XML Marshalling for classes registered with a <tt>SessionFactory</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 *************** *** 23,27 **** * <br> * It is not intended that implementors be threadsafe. ! * @see Datastore */ public interface Databinder { --- 23,27 ---- * <br> * It is not intended that implementors be threadsafe. ! * @see SessionFactory */ public interface Databinder { Index: Hibernate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Hibernate.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Hibernate.java 25 Jan 2003 09:35:52 -0000 1.4 --- Hibernate.java 26 Jan 2003 01:33:34 -0000 1.5 *************** *** 9,17 **** import java.sql.SQLException; - import net.sf.hibernate.cfg.Configuration; - import net.sf.hibernate.cfg.Datastore; import net.sf.hibernate.collection.PersistentCollection; - import net.sf.hibernate.impl.DatastoreImpl; - import net.sf.hibernate.impl.SessionFactoryObjectFactory; import net.sf.hibernate.lob.BlobImpl; import net.sf.hibernate.lob.ClobImpl; --- 9,13 ---- *************** *** 53,58 **** * Provides access to the full range of Hibernate built-in types. <tt>Type</tt> * instances may be used to bind values to query parameters. ! * Also a factory for <tt>Datastore</tt>. ! * @see Datastore * @see net.sf.hibernate.type.Type */ --- 49,55 ---- * Provides access to the full range of Hibernate built-in types. <tt>Type</tt> * instances may be used to bind values to query parameters. ! * Also a factory for new <tt>Blob</tt>s and <tt>Clob</tt>s. ! * @see java.sql.Clob ! * @see java.sql.Blob * @see net.sf.hibernate.type.Type */ *************** *** 198,231 **** public static Type custom(Class userTypeClass) throws HibernateException { return new CustomType(userTypeClass); - } - /** - * Create an new, uninitialized <tt>Datastore</tt>. - * @see Datastore - */ - public static Datastore createDatastore() { - return new DatastoreImpl(); - } - - private static boolean configured; - - /** - * Configure <tt>SessionFactory</tt>(s) from resource <tt>/hibernate.cfg.xml</tt>. The application - * may then obtain references to the factory(s) using JNDI lookups. This method may be called multiple - * times but will do its work exactly once. Mainly intended for J2EE clients who cannot fully control - * system initialization. - * @see net.sf.hibernate.cfg.Configuration - */ - public static void configure() throws HibernateException { - - synchronized (Hibernate.class) { - if (!configured) { - - //probably not really necessary ... but perhaps nice to have - SessionFactoryObjectFactory.clear(); - - new Configuration("/hibernate.cfg.xml").configure(); - configured = true; - } - } } --- 195,198 ---- Index: Interceptor.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Interceptor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Interceptor.java 22 Jan 2003 13:09:19 -0000 1.4 --- Interceptor.java 26 Jan 2003 01:33:34 -0000 1.5 *************** *** 20,24 **** * * @see SessionFactory#openSession(Interceptor) ! * @see Datastore#buildSessionFactory(Interceptor) */ public interface Interceptor { --- 20,24 ---- * * @see SessionFactory#openSession(Interceptor) ! * @see net.sf.hibernate.cfg.Configuration#buildSessionFactory(Interceptor) */ public interface Interceptor { Index: SessionFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/SessionFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SessionFactory.java 14 Jan 2003 14:07:11 -0000 1.5 --- SessionFactory.java 26 Jan 2003 01:33:34 -0000 1.6 *************** *** 22,26 **** * 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> * <table> --- 22,26 ---- * defined in a resource named <tt>/hibernate.properties</tt> in * the classpath or a <tt>java.util.Properties</tt> passed to ! * <tt>Configuration.buildSessionFactory()</tt><br> * <br> * <table> *************** *** 112,117 **** * </table> * - * @see Datastore * @see Session * @see net.sf.hibernate.connection.ConnectionProvider * @see net.sf.hibernate.transaction.TransactionFactory --- 112,117 ---- * </table> * * @see Session + * @see net.sf.hibernate.cfg.Configuration * @see net.sf.hibernate.connection.ConnectionProvider * @see net.sf.hibernate.transaction.TransactionFactory Index: hibernate-configuration.dtd =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-configuration.dtd,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** hibernate-configuration.dtd 1 Jan 2003 13:53:42 -0000 1.1.1.1 --- hibernate-configuration.dtd 26 Jan 2003 01:33:34 -0000 1.2 *************** *** 11,16 **** --> - <!ELEMENT hibernate-configuration (property*,session-factory+)> - <!ELEMENT property (#PCDATA)> <!ATTLIST property name CDATA #REQUIRED> --- 11,14 ---- --- Environment.java DELETED --- |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/jmx Modified Files: HibernateService.java HibernateServiceMBean.java SessionFactoryStub.java Log Message: redesigned configuration API Index: HibernateService.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/HibernateService.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HibernateService.java 20 Jan 2003 12:48:12 -0000 1.4 --- HibernateService.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 2,7 **** package net.sf.hibernate.jmx; - import java.util.Properties; - import javax.naming.InitialContext; import javax.naming.NamingException; --- 2,5 ---- *************** *** 10,17 **** import org.apache.commons.logging.LogFactory; - import net.sf.hibernate.Environment; - import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.cfg.Datastore; import net.sf.hibernate.util.PropertiesHelper; import net.sf.hibernate.util.StringHelper; --- 8,14 ---- import org.apache.commons.logging.LogFactory; import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.cfg.Configuration; ! import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.util.PropertiesHelper; import net.sf.hibernate.util.StringHelper; *************** *** 26,34 **** * @see net.sf.hibernate.SessionFactory */ ! public class HibernateService implements HibernateServiceMBean { private static final Log log = LogFactory.getLog(HibernateServiceMBean.class); - private final Properties props = new Properties(); private String mapResources; private String boundName; --- 23,30 ---- * @see net.sf.hibernate.SessionFactory */ ! public class HibernateService extends Configuration implements HibernateServiceMBean { private static final Log log = LogFactory.getLog(HibernateServiceMBean.class); private String mapResources; private String boundName; *************** *** 39,43 **** */ public String getName() { ! return props.getProperty(Environment.SESSION_FACTORY_NAME); } --- 35,39 ---- */ public String getName() { ! return getProperty(Environment.SESSION_FACTORY_NAME); } *************** *** 47,51 **** public void setMapResources(String mapResources) { ! this.mapResources = mapResources.trim(); } --- 43,52 ---- public void setMapResources(String mapResources) { ! if (mapResources==null) { ! this.mapResources=null; ! } ! else { ! this.mapResources = mapResources.trim(); ! } } *************** *** 60,118 **** public String getDatasource() { ! return props.getProperty(Environment.DATASOURCE); } public void setDatasource(String datasource) { ! props.setProperty(Environment.DATASOURCE, datasource); } public String getDialect() { ! return props.getProperty(Environment.DIALECT); } public void setDialect(String dialect) { ! props.setProperty(Environment.DIALECT, dialect); } public String getJndiName() { ! return props.getProperty(Environment.SESSION_FACTORY_NAME); } public void setJndiName(String jndiName) { ! props.setProperty(Environment.SESSION_FACTORY_NAME, jndiName); } public boolean getUseOuterJoin() { ! String prop = props.getProperty(Environment.OUTER_JOIN); return Boolean.valueOf(prop).booleanValue(); } public void setUseOuterJoin(boolean uoj) { ! 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); } public void setUserName(String userName) { ! props.setProperty(Environment.USER, userName); } public String getPassword() { ! return props.getProperty(Environment.PASS); } public void setPassword(String password) { ! props.setProperty(Environment.PASS, password); } --- 61,119 ---- public String getDatasource() { ! return getProperty(Environment.DATASOURCE); } public void setDatasource(String datasource) { ! setProperty(Environment.DATASOURCE, datasource); } public String getDialect() { ! return getProperty(Environment.DIALECT); } public void setDialect(String dialect) { ! setProperty(Environment.DIALECT, dialect); } public String getJndiName() { ! return getProperty(Environment.SESSION_FACTORY_NAME); } public void setJndiName(String jndiName) { ! setProperty(Environment.SESSION_FACTORY_NAME, jndiName); } public boolean getUseOuterJoin() { ! String prop = getProperty(Environment.OUTER_JOIN); return Boolean.valueOf(prop).booleanValue(); } public void setUseOuterJoin(boolean uoj) { ! setProperty( Environment.OUTER_JOIN, uoj ? "true" : "false" ); //Boolean.toString() only in JDK1.4 } public boolean getShowSql() { ! String prop = getProperty(Environment.SHOW_SQL); return Boolean.valueOf(prop).booleanValue(); } public void setShowSql(boolean showSql) { ! setProperty(Environment.SHOW_SQL, showSql ? "true" : "false"); } public String getUserName() { ! return getProperty(Environment.USER); } public void setUserName(String userName) { ! setProperty(Environment.USER, userName); } public String getPassword() { ! return getProperty(Environment.PASS); } public void setPassword(String password) { ! setProperty(Environment.PASS, password); } *************** *** 129,133 **** log.info("Could not build SessionFactory using the MBean classpath - will try again using client classpath"); String[] mappingFiles = parseResourceList( getMapResources() ); ! new SessionFactoryStub(mappingFiles, props); } } --- 130,134 ---- log.info("Could not build SessionFactory using the MBean classpath - will try again using client classpath"); String[] mappingFiles = parseResourceList( getMapResources() ); ! new SessionFactoryStub(mappingFiles, this); } } *************** *** 144,187 **** 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] ); ! ds.storeResource( mappingFiles[i], Thread.currentThread().getContextClassLoader() ); } ! ds.buildSessionFactory(props); } public String getTransactionStrategy() { ! return props.getProperty(Environment.TRANSACTION_STRATEGY); } public String getUserTransactionName() { ! return props.getProperty(Environment.USER_TRANSACTION); } public void setTransactionStrategy(String txnStrategy) { ! 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); } --- 145,184 ---- private void bindSessionFactory() throws HibernateException { ! log.info( "starting service at JNDI name: " + boundName ); ! log.info( "properties: " + getProperties() ); ! String[] mappingFiles = parseResourceList( getMapResources() ); for ( int i=0; i<mappingFiles.length; i++ ) { log.info( "compiling mapping: " + mappingFiles[i] ); ! addResource( mappingFiles[i], Thread.currentThread().getContextClassLoader() ); } ! buildSessionFactory(); } public String getTransactionStrategy() { ! return getProperty(Environment.TRANSACTION_STRATEGY); } public String getUserTransactionName() { ! return getProperty(Environment.USER_TRANSACTION); } public void setTransactionStrategy(String txnStrategy) { ! setProperty(Environment.TRANSACTION_STRATEGY, txnStrategy); } public void setUserTransactionName(String utName) { ! setProperty(Environment.USER_TRANSACTION, utName); } public String getTransactionManagerLookupStrategy() { ! return getProperty(Environment.TRANSACTION_MANAGER_STRATEGY); } public void setTransactionManagerLookupStrategy(String lkpStrategy) { ! setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, lkpStrategy); ! } ! ! public String getPropertyList() { ! return getProperties().toString(); } Index: HibernateServiceMBean.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/HibernateServiceMBean.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HibernateServiceMBean.java 5 Jan 2003 02:11:21 -0000 1.3 --- HibernateServiceMBean.java 26 Jan 2003 01:33:35 -0000 1.4 *************** *** 33,41 **** */ public void setProperty(String property, String value); /** ! * Display all properties to the user ! * @return String */ ! public String getProperties(); /** --- 33,49 ---- */ public void setProperty(String property, String value); + /** ! * Get a property ! * @param property the property name ! * @return the property value */ ! public String getProperty(String property); ! ! /** ! * Display the properties ! * @return a list of property names and values ! */ ! public String getPropertyList(); /** Index: SessionFactoryStub.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/SessionFactoryStub.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SessionFactoryStub.java 14 Jan 2003 13:42:15 -0000 1.4 --- SessionFactoryStub.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 6,10 **** import java.sql.Connection; import java.util.Map; - import java.util.Properties; import javax.naming.NamingException; --- 6,9 ---- *************** *** 17,22 **** import net.sf.hibernate.AssertionFailure; import net.sf.hibernate.Databinder; - import net.sf.hibernate.Environment; - import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; import net.sf.hibernate.Interceptor; --- 16,19 ---- *************** *** 24,28 **** import net.sf.hibernate.Session; import net.sf.hibernate.SessionFactory; ! import net.sf.hibernate.cfg.Datastore; import net.sf.hibernate.id.IdentifierGenerator; import net.sf.hibernate.id.UUIDHexGenerator; --- 21,26 ---- import net.sf.hibernate.Session; import net.sf.hibernate.SessionFactory; ! import net.sf.hibernate.cfg.Configuration; ! import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.id.IdentifierGenerator; import net.sf.hibernate.id.UUIDHexGenerator; *************** *** 45,56 **** private transient SessionFactory impl; private transient String[] resources; ! private transient Properties properties; private String uuid; private String name; ! SessionFactoryStub(String[] resources, Properties properties) { this.resources = resources; ! this.properties = properties; ! this.name = properties.getProperty(Environment.SESSION_FACTORY_NAME); try { uuid = (String) uuidgen.generate(null, null); --- 43,54 ---- private transient SessionFactory impl; private transient String[] resources; ! private transient Configuration mapper; private String uuid; private String name; ! SessionFactoryStub(String[] resources, Configuration mapper) { this.resources = resources; ! this.mapper = mapper; ! this.name = mapper.getProperty(Environment.SESSION_FACTORY_NAME); try { uuid = (String) uuidgen.generate(null, null); *************** *** 60,64 **** } ! SessionFactoryObjectFactory.addInstance(uuid, name, this, properties); } --- 58,62 ---- } ! SessionFactoryObjectFactory.addInstance( uuid, name, this, mapper.getProperties() ); } *************** *** 76,84 **** if (impl==null) { try { - Datastore ds = Hibernate.createDatastore(); for ( int i=0; i<resources.length; i++ ) { ! ds.storeResource( resources[i], Thread.currentThread().getContextClassLoader() ); } ! impl = ds.buildSessionFactory(properties); // now impl will be bound to the name this was bound to } --- 74,81 ---- if (impl==null) { try { for ( int i=0; i<resources.length; i++ ) { ! mapper.addResource( resources[i], Thread.currentThread().getContextClassLoader() ); } ! impl = mapper.buildSessionFactory(); // now impl will be bound to the name this was bound to } *************** *** 123,133 **** } ! public ClassMetadata getClassMetadata(Class persistentClass) ! throws HibernateException { return getImpl().getClassMetadata(persistentClass); } ! public CollectionMetadata getCollectionMetadata(String roleName) ! throws HibernateException { return getImpl().getCollectionMetadata(roleName); } --- 120,128 ---- } ! public ClassMetadata getClassMetadata(Class persistentClass) throws HibernateException { return getImpl().getClassMetadata(persistentClass); } ! public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException { return getImpl().getCollectionMetadata(roleName); } |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/test Modified Files: FooBarTest.java PerformanceTest.java TestCase.java Log Message: redesigned configuration API Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** FooBarTest.java 22 Jan 2003 13:35:18 -0000 1.14 --- FooBarTest.java 26 Jan 2003 01:33:36 -0000 1.15 *************** *** 22,26 **** import junit.framework.TestSuite; import net.sf.hibernate.Databinder; - import net.sf.hibernate.Environment; import net.sf.hibernate.FlushMode; import net.sf.hibernate.Hibernate; --- 22,25 ---- *************** *** 33,36 **** --- 32,36 ---- import net.sf.hibernate.Session; import net.sf.hibernate.Transaction; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.connection.ConnectionProvider; import net.sf.hibernate.connection.DriverManagerConnectionProvider; Index: PerformanceTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/PerformanceTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PerformanceTest.java 5 Jan 2003 02:11:23 -0000 1.3 --- PerformanceTest.java 26 Jan 2003 01:33:36 -0000 1.4 *************** *** 3,6 **** --- 3,7 ---- import net.sf.hibernate.*; + import net.sf.hibernate.cfg.*; import net.sf.hibernate.connection.ConnectionProvider; import net.sf.hibernate.connection.ConnectionProviderFactory; Index: TestCase.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/TestCase.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestCase.java 5 Jan 2003 02:11:23 -0000 1.3 --- TestCase.java 26 Jan 2003 01:33:36 -0000 1.4 *************** *** 2,7 **** package net.sf.hibernate.test; ! import net.sf.hibernate.*; ! import net.sf.hibernate.cfg.*; import net.sf.hibernate.dialect.Dialect; import net.sf.hibernate.tool.hbm2ddl.SchemaExport; --- 2,7 ---- package net.sf.hibernate.test; ! import net.sf.hibernate.SessionFactory; ! import net.sf.hibernate.cfg.Configuration; import net.sf.hibernate.dialect.Dialect; import net.sf.hibernate.tool.hbm2ddl.SchemaExport; *************** *** 22,29 **** public static void exportSchema(String[] files) throws Exception { ! Datastore ds = Hibernate.createDatastore(); for (int i=0; i<files.length; i++) { ! ds.storeResource( "net/sf/hibernate/test/" + files[i], TestCase.class.getClassLoader() ); } --- 22,29 ---- public static void exportSchema(String[] files) throws Exception { ! Configuration ds = new Configuration(); for (int i=0; i<files.length; i++) { ! ds.addResource( "net/sf/hibernate/test/" + files[i], TestCase.class.getClassLoader() ); } |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/mapping Modified Files: Collection.java Log Message: redesigned configuration API Index: Collection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Collection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Collection.java 19 Jan 2003 11:47:07 -0000 1.8 --- Collection.java 26 Jan 2003 01:33:35 -0000 1.9 *************** *** 10,16 **** import org.w3c.dom.NodeList; - import net.sf.hibernate.Environment; import net.sf.hibernate.MappingException; import net.sf.hibernate.cache.CacheConcurrencyStrategy; import net.sf.hibernate.util.StringHelper; import net.sf.hibernate.type.PersistentCollectionType; --- 10,16 ---- import org.w3c.dom.NodeList; import net.sf.hibernate.MappingException; import net.sf.hibernate.cache.CacheConcurrencyStrategy; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.util.StringHelper; import net.sf.hibernate.type.PersistentCollectionType; |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/eg In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/eg Modified Files: NetworkDemo.java Log Message: redesigned configuration API Index: NetworkDemo.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/eg/NetworkDemo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NetworkDemo.java 5 Jan 2003 02:11:20 -0000 1.3 --- NetworkDemo.java 26 Jan 2003 01:33:35 -0000 1.4 *************** *** 2,10 **** package net.sf.hibernate.eg; ! import java.util.*; ! import java.io.*; ! import net.sf.hibernate.*; ! import net.sf.hibernate.cfg.*; import net.sf.hibernate.tool.hbm2ddl.SchemaExport; --- 2,15 ---- package net.sf.hibernate.eg; ! import java.io.BufferedReader; ! import java.io.InputStreamReader; ! import java.util.Iterator; ! import java.util.StringTokenizer; ! import net.sf.hibernate.Databinder; ! import net.sf.hibernate.Hibernate; ! import net.sf.hibernate.Session; ! import net.sf.hibernate.SessionFactory; ! import net.sf.hibernate.cfg.Configuration; import net.sf.hibernate.tool.hbm2ddl.SchemaExport; *************** *** 16,28 **** private static SessionFactory sessions; ! private static Datastore ds; public static void main( String[] no_args ) throws Exception { ! // configure the Datastore ! ds = Hibernate.createDatastore() ! .storeClass(Vertex.class) ! .storeClass(Edge.class); // build a SessionFactory --- 21,33 ---- private static SessionFactory sessions; ! private static Configuration ds; public static void main( String[] no_args ) throws Exception { ! // configure the Configuration ! ds = new Configuration() ! .addClass(Vertex.class) ! .addClass(Edge.class); // build a SessionFactory |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/persister Modified Files: AbstractEntityPersister.java Log Message: redesigned configuration API Index: AbstractEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/AbstractEntityPersister.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AbstractEntityPersister.java 25 Jan 2003 00:13:55 -0000 1.8 --- AbstractEntityPersister.java 26 Jan 2003 01:33:36 -0000 1.9 *************** *** 12,16 **** import org.apache.commons.logging.LogFactory; - import net.sf.hibernate.Environment; import net.sf.hibernate.HibernateException; import net.sf.hibernate.InstantiationException; --- 12,15 ---- *************** *** 21,24 **** --- 20,24 ---- import net.sf.hibernate.Validatable; import net.sf.hibernate.cache.CacheConcurrencyStrategy; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.engine.Cascades; import net.sf.hibernate.engine.SessionFactoryImplementor; |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/connection Modified Files: C3P0ConnectionProvider.java ConnectionProviderFactory.java DBCPConnectionProvider.java DatasourceConnectionProvider.java DriverManagerConnectionProvider.java Log Message: redesigned configuration API Index: C3P0ConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/C3P0ConnectionProvider.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** C3P0ConnectionProvider.java 15 Jan 2003 10:33:16 -0000 1.4 --- C3P0ConnectionProvider.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 13,18 **** import com.mchange.v2.c3p0.DataSources; - import net.sf.hibernate.Environment; import net.sf.hibernate.HibernateException; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.PropertiesHelper; --- 13,18 ---- import com.mchange.v2.c3p0.DataSources; import net.sf.hibernate.HibernateException; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.PropertiesHelper; Index: ConnectionProviderFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/ConnectionProviderFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConnectionProviderFactory.java 15 Jan 2003 10:33:16 -0000 1.5 --- ConnectionProviderFactory.java 26 Jan 2003 01:33:35 -0000 1.6 *************** *** 10,15 **** import org.apache.commons.logging.LogFactory; - import net.sf.hibernate.Environment; import net.sf.hibernate.HibernateException; import net.sf.hibernate.util.ReflectHelper; --- 10,15 ---- import org.apache.commons.logging.LogFactory; import net.sf.hibernate.HibernateException; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.util.ReflectHelper; Index: DBCPConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/DBCPConnectionProvider.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DBCPConnectionProvider.java 15 Jan 2003 10:33:17 -0000 1.4 --- DBCPConnectionProvider.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 19,24 **** import org.apache.commons.pool.impl.GenericObjectPool; - import net.sf.hibernate.Environment; import net.sf.hibernate.HibernateException; import net.sf.hibernate.util.JDBCExceptionReporter; --- 19,24 ---- import org.apache.commons.pool.impl.GenericObjectPool; import net.sf.hibernate.HibernateException; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.util.JDBCExceptionReporter; Index: DatasourceConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/DatasourceConnectionProvider.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DatasourceConnectionProvider.java 5 Jan 2003 02:11:20 -0000 1.3 --- DatasourceConnectionProvider.java 26 Jan 2003 01:33:35 -0000 1.4 *************** *** 4,7 **** --- 4,8 ---- import java.util.Properties; import net.sf.hibernate.*; + import net.sf.hibernate.cfg.*; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.NamingHelper; Index: DriverManagerConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/DriverManagerConnectionProvider.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DriverManagerConnectionProvider.java 15 Jan 2003 10:33:17 -0000 1.5 --- DriverManagerConnectionProvider.java 26 Jan 2003 01:33:35 -0000 1.6 *************** *** 9,14 **** 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; --- 9,14 ---- import java.util.Properties; import net.sf.hibernate.HibernateException; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.PropertiesHelper; |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/tool/hbm2ddl Modified Files: SchemaExport.java SchemaUpdate.java Log Message: redesigned configuration API Index: SchemaExport.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl/SchemaExport.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SchemaExport.java 20 Jan 2003 12:48:16 -0000 1.5 --- SchemaExport.java 26 Jan 2003 01:33:36 -0000 1.6 *************** *** 11,18 **** import java.util.StringTokenizer; - import net.sf.hibernate.Environment; - import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.cfg.Datastore; import net.sf.hibernate.connection.ConnectionProvider; import net.sf.hibernate.connection.ConnectionProviderFactory; --- 11,17 ---- import java.util.StringTokenizer; import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.cfg.Configuration; ! import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.connection.ConnectionProvider; import net.sf.hibernate.connection.ConnectionProviderFactory; *************** *** 22,26 **** /** ! * Commandline tool to export table schema for a configured Datastore to the database. */ --- 21,25 ---- /** ! * Commandline tool to export table schema for a configured <tt>Configuration</tt> to the database. */ *************** *** 33,39 **** /** ! * Create a schema exporter for the given Datastore. */ ! public SchemaExport(Datastore ds) throws HibernateException { connectionProperties = Environment.getProperties(); Dialect dialect = Dialect.getDialect(); --- 32,38 ---- /** ! * Create a schema exporter for the given Configuration */ ! public SchemaExport(Configuration ds) throws HibernateException { connectionProperties = Environment.getProperties(); Dialect dialect = Dialect.getDialect(); *************** *** 43,50 **** /** ! * Create a schema exporter for the given Datastore, with the given * database connection properties. */ ! public SchemaExport(Datastore ds, Properties connectionProperties) throws HibernateException { this.connectionProperties = connectionProperties; Dialect dialect = Dialect.getDialect(connectionProperties); --- 42,49 ---- /** ! * Create a schema exporter for the given Configuration, with the given * database connection properties. */ ! public SchemaExport(Configuration ds, Properties connectionProperties) throws HibernateException { this.connectionProperties = connectionProperties; Dialect dialect = Dialect.getDialect(connectionProperties); *************** *** 231,235 **** public static void main(String[] args) { try { ! Datastore ds = Hibernate.createDatastore(); boolean script = true; --- 230,234 ---- public static void main(String[] args) { try { ! Configuration ds = new Configuration(); boolean script = true; *************** *** 268,275 **** String filename = args[i]; if ( filename.endsWith( ".jar" ) ) { ! ds.storeJar(filename); } else { ! ds.storeFile(filename); } } --- 267,274 ---- String filename = args[i]; if ( filename.endsWith( ".jar" ) ) { ! ds.addJar(filename); } else { ! ds.addFile(filename); } } Index: SchemaUpdate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl/SchemaUpdate.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SchemaUpdate.java 24 Jan 2003 13:38:36 -0000 1.4 --- SchemaUpdate.java 26 Jan 2003 01:33:36 -0000 1.5 *************** *** 2,18 **** package net.sf.hibernate.tool.hbm2ddl; ! import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.dialect.Dialect; ! import net.sf.hibernate.cfg.Datastore; import net.sf.hibernate.connection.ConnectionProvider; import net.sf.hibernate.connection.ConnectionProviderFactory; ! ! import java.util.*; ! import java.io.FileInputStream; ! import java.sql.*; ! ! import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; /* --- 2,18 ---- package net.sf.hibernate.tool.hbm2ddl; ! import java.io.FileInputStream; ! import java.sql.Connection; ! import java.sql.SQLException; ! import java.sql.Statement; ! import java.util.Properties; ! import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.cfg.Configuration; import net.sf.hibernate.connection.ConnectionProvider; import net.sf.hibernate.connection.ConnectionProviderFactory; ! import net.sf.hibernate.dialect.Dialect; import org.apache.commons.logging.Log; + import org.apache.commons.logging.LogFactory; /* *************** *** 27,34 **** Log log = LogFactory.getLog( getClass() ); private ConnectionProvider cp; ! Datastore store; Dialect dialect; ! public SchemaUpdate(Datastore store) throws HibernateException, SQLException { this.store = store; dialect = Dialect.getDialect(); --- 27,34 ---- Log log = LogFactory.getLog( getClass() ); private ConnectionProvider cp; ! Configuration store; Dialect dialect; ! public SchemaUpdate(Configuration store) throws HibernateException, SQLException { this.store = store; dialect = Dialect.getDialect(); *************** *** 36,40 **** } ! public SchemaUpdate(Datastore store, Properties connectionProperties) throws HibernateException { this.store = store; dialect = Dialect.getDialect(connectionProperties); --- 36,40 ---- } ! public SchemaUpdate(Configuration store, Properties connectionProperties) throws HibernateException { this.store = store; dialect = Dialect.getDialect(connectionProperties); *************** *** 45,49 **** try { ! Datastore ds = Hibernate.createDatastore(); boolean script = true; --- 45,49 ---- try { ! Configuration ds = new Configuration(); boolean script = true; *************** *** 60,64 **** } else { ! ds.storeFile(args[i]); } --- 60,64 ---- } else { ! ds.addFile(args[i]); } |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/engine Modified Files: Mapping.java Log Message: redesigned configuration API Index: Mapping.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/Mapping.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Mapping.java 5 Jan 2003 02:11:20 -0000 1.3 --- Mapping.java 26 Jan 2003 01:33:35 -0000 1.4 *************** *** 7,15 **** /** * Defines operations common to "compiled" mappings (ie. <tt>SessionFactory</tt>) ! * and "uncompiled" mappings (ie. <tt>Datastore</tt>) that are used by * implementors of <tt>Type</tt>. * @see net.sf.hibernate.type.Type * @see net.sf.hibernate.impl.SessionFactoryImpl ! * @see net.sf.hibernate.impl.DatastoreImpl */ public interface Mapping { --- 7,15 ---- /** * Defines operations common to "compiled" mappings (ie. <tt>SessionFactory</tt>) ! * and "uncompiled" mappings (ie. <tt>Configuration</tt>) that are used by * implementors of <tt>Type</tt>. * @see net.sf.hibernate.type.Type * @see net.sf.hibernate.impl.SessionFactoryImpl ! * @see net.sf.hibernate.cfg.Configuration */ public interface Mapping { |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/dialect Modified Files: DB2Dialect.java Dialect.java HSQLDialect.java InterbaseDialect.java MckoiDialect.java MySQLDialect.java OracleDialect.java PointbaseDialect.java PostgreSQLDialect.java SAPDBDialect.java SybaseDialect.java Log Message: redesigned configuration API Index: DB2Dialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/DB2Dialect.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DB2Dialect.java 9 Jan 2003 12:24:50 -0000 1.4 --- DB2Dialect.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 4,8 **** import java.sql.Types; ! import net.sf.hibernate.Environment; /** --- 4,8 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; /** Index: Dialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/Dialect.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Dialect.java 20 Jan 2003 12:48:09 -0000 1.5 --- Dialect.java 26 Jan 2003 01:33:35 -0000 1.6 *************** *** 7,15 **** import org.apache.commons.logging.LogFactory; import net.sf.hibernate.sql.ANSIOuterJoinFragment; import net.sf.hibernate.sql.OuterJoinFragment; import net.sf.hibernate.util.ReflectHelper; import net.sf.hibernate.util.StringHelper; - import net.sf.hibernate.Environment; import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; --- 7,15 ---- import org.apache.commons.logging.LogFactory; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.sql.ANSIOuterJoinFragment; import net.sf.hibernate.sql.OuterJoinFragment; import net.sf.hibernate.util.ReflectHelper; import net.sf.hibernate.util.StringHelper; import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; Index: HSQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/HSQLDialect.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HSQLDialect.java 9 Jan 2003 12:24:50 -0000 1.4 --- HSQLDialect.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 6,10 **** import java.sql.Types; ! import net.sf.hibernate.Environment; /** --- 6,10 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; /** Index: InterbaseDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/InterbaseDialect.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** InterbaseDialect.java 9 Jan 2003 12:24:50 -0000 1.4 --- InterbaseDialect.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 4,8 **** import java.sql.Types; ! import net.sf.hibernate.Environment; /** --- 4,8 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; /** Index: MckoiDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/MckoiDialect.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MckoiDialect.java 9 Jan 2003 12:24:50 -0000 1.4 --- MckoiDialect.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 5,9 **** import java.sql.Types; ! import net.sf.hibernate.Environment; /** Represents an SQL dialect compatible with McKoi --- 5,9 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; /** Represents an SQL dialect compatible with McKoi Index: MySQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/MySQLDialect.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MySQLDialect.java 20 Jan 2003 12:48:09 -0000 1.4 --- MySQLDialect.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 4,8 **** import java.sql.Types; ! import net.sf.hibernate.Environment; import net.sf.hibernate.util.StringHelper; --- 4,8 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.util.StringHelper; Index: OracleDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/OracleDialect.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OracleDialect.java 20 Jan 2003 12:48:09 -0000 1.5 --- OracleDialect.java 26 Jan 2003 01:33:35 -0000 1.6 *************** *** 4,8 **** import java.sql.Types; ! import net.sf.hibernate.Environment; import net.sf.hibernate.sql.OracleOuterJoinFragment; import net.sf.hibernate.sql.OuterJoinFragment; --- 4,8 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.sql.OracleOuterJoinFragment; import net.sf.hibernate.sql.OuterJoinFragment; Index: PointbaseDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/PointbaseDialect.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PointbaseDialect.java 5 Jan 2003 02:11:20 -0000 1.3 --- PointbaseDialect.java 26 Jan 2003 01:33:35 -0000 1.4 *************** *** 5,9 **** import java.sql.Types; ! import net.sf.hibernate.Environment; /** * A <tt>Dialect</tt> for Pointbase. --- 5,9 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; /** * A <tt>Dialect</tt> for Pointbase. Index: PostgreSQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/PostgreSQLDialect.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PostgreSQLDialect.java 9 Jan 2003 12:24:50 -0000 1.4 --- PostgreSQLDialect.java 26 Jan 2003 01:33:35 -0000 1.5 *************** *** 4,8 **** import java.sql.Types; ! import net.sf.hibernate.Environment; /** --- 4,8 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; /** Index: SAPDBDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/SAPDBDialect.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SAPDBDialect.java 20 Jan 2003 12:48:09 -0000 1.5 --- SAPDBDialect.java 26 Jan 2003 01:33:35 -0000 1.6 *************** *** 5,9 **** import java.sql.Types; ! import net.sf.hibernate.Environment; import net.sf.hibernate.sql.OracleOuterJoinFragment; import net.sf.hibernate.sql.OuterJoinFragment; --- 5,9 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.sql.OracleOuterJoinFragment; import net.sf.hibernate.sql.OuterJoinFragment; Index: SybaseDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/SybaseDialect.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SybaseDialect.java 5 Jan 2003 02:11:20 -0000 1.3 --- SybaseDialect.java 26 Jan 2003 01:33:35 -0000 1.4 *************** *** 4,8 **** import java.sql.Types; ! import net.sf.hibernate.Environment; /** --- 4,8 ---- import java.sql.Types; ! import net.sf.hibernate.cfg.Environment; /** |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/loader Modified Files: Loader.java Log Message: redesigned configuration API Index: Loader.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/Loader.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Loader.java 20 Jan 2003 12:48:12 -0000 1.7 --- Loader.java 26 Jan 2003 01:33:35 -0000 1.8 *************** *** 14,21 **** import org.apache.commons.logging.LogFactory; - import net.sf.hibernate.Environment; import net.sf.hibernate.HibernateException; import net.sf.hibernate.LockMode; import net.sf.hibernate.WrongClassException; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; --- 14,21 ---- import org.apache.commons.logging.LogFactory; import net.sf.hibernate.HibernateException; import net.sf.hibernate.LockMode; import net.sf.hibernate.WrongClassException; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/util In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/util Modified Files: NamingHelper.java Log Message: redesigned configuration API Index: NamingHelper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/util/NamingHelper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NamingHelper.java 20 Jan 2003 12:48:17 -0000 1.4 --- NamingHelper.java 26 Jan 2003 01:33:36 -0000 1.5 *************** *** 15,19 **** import org.apache.commons.logging.LogFactory; ! import net.sf.hibernate.Environment; public final class NamingHelper { --- 15,19 ---- import org.apache.commons.logging.LogFactory; ! import net.sf.hibernate.cfg.Environment; public final class NamingHelper { |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/odmg In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/odmg Modified Files: Database.java Log Message: redesigned configuration API Index: Database.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/odmg/Database.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Database.java 14 Jan 2003 13:42:16 -0000 1.4 --- Database.java 26 Jan 2003 01:33:36 -0000 1.5 *************** *** 6,14 **** import org.odmg.ObjectNameNotFoundException; import org.odmg.ObjectNameNotUniqueException; ! import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; import net.sf.hibernate.ObjectNotFoundException; import net.sf.hibernate.Session; import net.sf.hibernate.SessionFactory; import net.sf.hibernate.impl.SessionFactoryObjectFactory; --- 6,15 ---- import org.odmg.ObjectNameNotFoundException; import org.odmg.ObjectNameNotUniqueException; ! import net.sf.hibernate.HibernateException; import net.sf.hibernate.ObjectNotFoundException; import net.sf.hibernate.Session; import net.sf.hibernate.SessionFactory; + import net.sf.hibernate.cfg.Configuration; import net.sf.hibernate.impl.SessionFactoryObjectFactory; *************** *** 29,32 **** --- 30,34 ---- */ public class Database implements org.odmg.Database { + private SessionFactory sessionFactory; private final ThreadLocal threadTransaction = new ThreadLocal(); *************** *** 80,84 **** public void open(String name, int accessMode) throws ODMGException { try { ! Hibernate.configure(); } catch (HibernateException he) { --- 82,86 ---- public void open(String name, int accessMode) throws ODMGException { try { ! new Configuration().configure(); } catch (HibernateException he) { |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/impl Modified Files: SessionFactoryImpl.java Log Message: redesigned configuration API Index: SessionFactoryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionFactoryImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SessionFactoryImpl.java 20 Jan 2003 12:48:11 -0000 1.6 --- SessionFactoryImpl.java 26 Jan 2003 01:33:35 -0000 1.7 *************** *** 33,37 **** import net.sf.hibernate.AssertionFailure; import net.sf.hibernate.Databinder; - import net.sf.hibernate.Environment; import net.sf.hibernate.HibernateException; import net.sf.hibernate.Interceptor; --- 33,36 ---- *************** *** 42,45 **** --- 41,45 ---- import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cache.Timestamper; + import net.sf.hibernate.cfg.*; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.connection.ConnectionProvider; *************** *** 114,118 **** private static final Log log = LogFactory.getLog(SessionFactoryImpl.class); ! public SessionFactoryImpl(DatastoreImpl datastore, Properties properties, Interceptor interceptor) throws HibernateException { log.trace("Instantiating session factory"); --- 114,118 ---- private static final Log log = LogFactory.getLog(SessionFactoryImpl.class); ! public SessionFactoryImpl(Configuration datastore, Properties properties, Interceptor interceptor) throws HibernateException { log.trace("Instantiating session factory"); *************** *** 189,193 **** classPersisters = new HashMap(); classPersistersByName = new HashMap(); ! iter = datastore.getClassMaps(); while ( iter.hasNext() ) { PersistentClass model = (PersistentClass) iter.next(); --- 189,193 ---- classPersisters = new HashMap(); classPersistersByName = new HashMap(); ! iter = datastore.getClassMappings(); while ( iter.hasNext() ) { PersistentClass model = (PersistentClass) iter.next(); *************** *** 208,212 **** collectionPersisters = new HashMap(); ! iter = datastore.getCollectionMaps(); while ( iter.hasNext() ) { Collection map = (Collection) iter.next(); --- 208,212 ---- collectionPersisters = new HashMap(); ! iter = datastore.getCollectionMappings(); while ( iter.hasNext() ) { Collection map = (Collection) iter.next(); |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/transaction In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/transaction Modified Files: JTATransactionFactory.java Log Message: redesigned configuration API Index: JTATransactionFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/transaction/JTATransactionFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JTATransactionFactory.java 9 Jan 2003 12:24:52 -0000 1.4 --- JTATransactionFactory.java 26 Jan 2003 01:33:36 -0000 1.5 *************** *** 11,17 **** import java.util.Properties; - import net.sf.hibernate.Environment; import net.sf.hibernate.HibernateException; import net.sf.hibernate.Transaction; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.NamingHelper; --- 11,17 ---- import java.util.Properties; import net.sf.hibernate.HibernateException; import net.sf.hibernate.Transaction; + import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.NamingHelper; |
From: <one...@us...> - 2003-01-26 01:33:44
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type In directory sc8-pr-cvs1:/tmp/cvs-serv14128/sf/hibernate/type Modified Files: BinaryType.java Log Message: redesigned configuration API Index: BinaryType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BinaryType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BinaryType.java 25 Jan 2003 09:35:52 -0000 1.5 --- BinaryType.java 26 Jan 2003 01:33:36 -0000 1.6 *************** *** 11,16 **** import java.sql.Types; - import net.sf.hibernate.Environment; import net.sf.hibernate.HibernateException; public class BinaryType extends MutableType { --- 11,16 ---- import java.sql.Types; import net.sf.hibernate.HibernateException; + import net.sf.hibernate.cfg.Environment; public class BinaryType extends MutableType { |
From: <one...@us...> - 2003-01-25 09:35:55
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type In directory sc8-pr-cvs1:/tmp/cvs-serv27891/sf/hibernate/type Modified Files: BinaryType.java BlobType.java ClobType.java Log Message: added createClob(), createBlob() for streams Index: BinaryType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BinaryType.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BinaryType.java 19 Jan 2003 11:47:08 -0000 1.4 --- BinaryType.java 25 Jan 2003 09:35:52 -0000 1.5 *************** *** 2,13 **** package net.sf.hibernate.type; ! import net.sf.hibernate.Environment; ! import net.sf.hibernate.HibernateException; ! import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; ! import java.io.*; public class BinaryType extends MutableType { --- 2,16 ---- package net.sf.hibernate.type; ! import java.io.ByteArrayInputStream; ! import java.io.ByteArrayOutputStream; ! import java.io.IOException; ! import java.io.InputStream; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; ! ! import net.sf.hibernate.Environment; ! import net.sf.hibernate.HibernateException; public class BinaryType extends MutableType { Index: BlobType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BlobType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BlobType.java 19 Jan 2003 11:47:08 -0000 1.5 --- BlobType.java 25 Jan 2003 09:35:52 -0000 1.6 *************** *** 1,4 **** //$Id$ - package net.sf.hibernate.type; --- 1,3 ---- *************** *** 16,20 **** public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { if (value instanceof BlobImpl) { ! st.setBytes(index, ( (BlobImpl) value ).toBytes() ); } else { --- 15,20 ---- public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { if (value instanceof BlobImpl) { ! BlobImpl blob = (BlobImpl) value; ! st.setBinaryStream( index, blob.getBinaryStream(), (int) blob.length() ); } else { *************** *** 28,32 **** public int sqlType() { ! return Types.VARBINARY; //TODO: Types.BLOB } --- 28,32 ---- public int sqlType() { ! return Types.BLOB; } Index: ClobType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ClobType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClobType.java 19 Jan 2003 11:47:08 -0000 1.5 --- ClobType.java 25 Jan 2003 09:35:52 -0000 1.6 *************** *** 1,4 **** //$Id$ - package net.sf.hibernate.type; --- 1,3 ---- *************** *** 16,20 **** public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { if (value instanceof ClobImpl) { ! st.setString( index, ( (ClobImpl) value ).toString() ); } else { --- 15,20 ---- public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { if (value instanceof ClobImpl) { ! ClobImpl clob = (ClobImpl) value; ! st.setCharacterStream( index, clob.getCharacterStream(), (int) clob.length() ); } else { *************** *** 28,32 **** public int sqlType() { ! return Types.VARCHAR; //TODO: Types.CLOB } --- 28,32 ---- public int sqlType() { ! return Types.CLOB; } |
From: <one...@us...> - 2003-01-25 09:35:55
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/lob In directory sc8-pr-cvs1:/tmp/cvs-serv27891/sf/hibernate/lob Modified Files: BlobImpl.java ClobImpl.java Log Message: added createClob(), createBlob() for streams Index: BlobImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/lob/BlobImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BlobImpl.java 5 Jan 2003 02:11:21 -0000 1.3 --- BlobImpl.java 25 Jan 2003 09:35:52 -0000 1.4 *************** *** 10,21 **** public class BlobImpl implements Blob { ! private byte[] bytes; ! ! public byte[] toBytes() { ! return bytes; } ! public BlobImpl(byte[] bytes) { ! this.bytes = bytes; } --- 10,24 ---- public class BlobImpl implements Blob { ! private InputStream stream; ! private int length; ! ! public BlobImpl(byte[] bytes) { ! this.stream = new ByteArrayInputStream(bytes); ! this.length = bytes.length; } ! public BlobImpl(InputStream stream, int length) { ! this.stream = stream; ! this.length = length; } *************** *** 24,28 **** */ public long length() throws SQLException { ! return bytes.length; } --- 27,31 ---- */ public long length() throws SQLException { ! return length; } *************** *** 67,71 **** */ public InputStream getBinaryStream() throws SQLException { ! return new ByteArrayInputStream(bytes); } --- 70,74 ---- */ public InputStream getBinaryStream() throws SQLException { ! return stream; } Index: ClobImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/lob/ClobImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClobImpl.java 5 Jan 2003 02:11:21 -0000 1.3 --- ClobImpl.java 25 Jan 2003 09:35:52 -0000 1.4 *************** *** 2,10 **** package net.sf.hibernate.lob; - import java.io.CharArrayReader; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; ! import java.io.StringBufferInputStream; import java.io.Writer; import java.sql.Clob; --- 2,9 ---- package net.sf.hibernate.lob; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; ! import java.io.StringReader; import java.io.Writer; import java.sql.Clob; *************** *** 13,24 **** public class ClobImpl implements Clob { ! private char[] chars; public ClobImpl(String string) { ! chars = string.toCharArray(); } ! ! public String toString() { ! return new String(chars); } --- 12,26 ---- public class ClobImpl implements Clob { ! private Reader reader; ! private int length; public ClobImpl(String string) { ! reader = new StringReader(string); ! length = string.length(); } ! ! public ClobImpl(Reader reader, int length) { ! this.reader = reader; ! this.length = length; } *************** *** 27,31 **** */ public long length() throws SQLException { ! return chars.length; } --- 29,33 ---- */ public long length() throws SQLException { ! return length; } *************** *** 41,45 **** */ public InputStream getAsciiStream() throws SQLException { ! return new StringBufferInputStream( new String(chars) ); } --- 43,47 ---- */ public InputStream getAsciiStream() throws SQLException { ! excep(); return null; } *************** *** 55,59 **** */ public Reader getCharacterStream() throws SQLException { ! return new CharArrayReader(chars); } --- 57,61 ---- */ public Reader getCharacterStream() throws SQLException { ! return reader; } |
From: <one...@us...> - 2003-01-25 09:35:55
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv27891/sf/hibernate Modified Files: Hibernate.java Log Message: added createClob(), createBlob() for streams Index: Hibernate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Hibernate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Hibernate.java 5 Jan 2003 02:11:19 -0000 1.3 --- Hibernate.java 25 Jan 2003 09:35:52 -0000 1.4 *************** *** 2,8 **** package net.sf.hibernate; ! import net.sf.hibernate.proxy.HibernateProxy; ! import net.sf.hibernate.proxy.HibernateProxyHelper; ! import net.sf.hibernate.type.*; import java.io.Serializable; import java.sql.Blob; --- 2,7 ---- package net.sf.hibernate; ! import java.io.InputStream; ! import java.io.Reader; import java.io.Serializable; import java.sql.Blob; *************** *** 10,15 **** import java.sql.SQLException; - import net.sf.hibernate.cfg.*; import net.sf.hibernate.cfg.Configuration; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.impl.DatastoreImpl; --- 9,14 ---- import java.sql.SQLException; import net.sf.hibernate.cfg.Configuration; + import net.sf.hibernate.cfg.Datastore; import net.sf.hibernate.collection.PersistentCollection; import net.sf.hibernate.impl.DatastoreImpl; *************** *** 17,20 **** --- 16,52 ---- import net.sf.hibernate.lob.BlobImpl; import net.sf.hibernate.lob.ClobImpl; + import net.sf.hibernate.proxy.HibernateProxy; + import net.sf.hibernate.proxy.HibernateProxyHelper; + import net.sf.hibernate.type.BigDecimalType; + import net.sf.hibernate.type.BinaryType; + import net.sf.hibernate.type.BlobType; + import net.sf.hibernate.type.BooleanType; + import net.sf.hibernate.type.ByteType; + import net.sf.hibernate.type.CalendarDateType; + import net.sf.hibernate.type.CalendarType; + import net.sf.hibernate.type.CharacterType; + import net.sf.hibernate.type.ClassType; + import net.sf.hibernate.type.ClobType; + import net.sf.hibernate.type.CurrencyType; + import net.sf.hibernate.type.CustomType; + import net.sf.hibernate.type.DateType; + import net.sf.hibernate.type.DoubleType; + import net.sf.hibernate.type.FloatType; + import net.sf.hibernate.type.IntegerType; + import net.sf.hibernate.type.LocaleType; + import net.sf.hibernate.type.LongType; + import net.sf.hibernate.type.ManyToOneType; + import net.sf.hibernate.type.NullableType; + import net.sf.hibernate.type.ObjectType; + import net.sf.hibernate.type.PersistentEnumType; + import net.sf.hibernate.type.SerializableType; + import net.sf.hibernate.type.ShortType; + import net.sf.hibernate.type.StringType; + import net.sf.hibernate.type.TimeType; + import net.sf.hibernate.type.TimeZoneType; + import net.sf.hibernate.type.TimestampType; + import net.sf.hibernate.type.TrueFalseType; + import net.sf.hibernate.type.Type; + import net.sf.hibernate.type.YesNoType; /** *************** *** 219,222 **** --- 251,255 ---- * Create a new <tt>Blob</tt>. The returned object will be * initially immutable. + * @param bytes a byte array */ public static Blob createBlob(byte[] bytes) { *************** *** 225,233 **** --- 258,287 ---- /** + * Create a new <tt>Blob</tt>. The returned object will be + * initially immutable. + * @param stream a binary stream + * @param length the number of bytes in the stream + */ + public static Blob createBlob(InputStream stream, int length) { + return new BlobImpl(stream, length); + } + + /** * Create a new <tt>Clob</tt>. The returned object will be * initially immutable. + * @param string a <tt>String</tt> */ public static Clob createClob(String string) { return new ClobImpl(string); + } + + /** + * Create a new <tt>Clob</tt>. The returned object will be + * initially immutable. + * @param reader a character stream + * @param length the number of characters in the stream + */ + public static Clob createClob(Reader reader, int length) { + return new ClobImpl(reader, length); } } |
From: <one...@us...> - 2003-01-25 09:30:32
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv25897 Modified Files: Hibernate.java Log Message: added createClob(), createBlob() for streams Index: Hibernate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/Hibernate.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Hibernate.java 30 Dec 2002 11:34:27 -0000 1.66 --- Hibernate.java 25 Jan 2003 09:30:29 -0000 1.67 *************** *** 5,8 **** --- 5,11 ---- import cirrus.hibernate.proxy.HibernateProxyHelper; import cirrus.hibernate.type.*; + + import java.io.InputStream; + import java.io.Reader; import java.io.Serializable; import java.sql.Blob; *************** *** 224,227 **** --- 227,238 ---- /** + * Create a new <tt>Blob</tt>. The returned object will be + * initially immutable. + */ + public static Blob createBlob(InputStream stream, int length) { + return new BlobImpl(stream, length); + } + + /** * Create a new <tt>Clob</tt>. The returned object will be * initially immutable. *************** *** 229,232 **** --- 240,252 ---- public static Clob createClob(String string) { return new ClobImpl(string); + + } + /** + * Create a new <tt>Clob</tt>. The returned object will be + * initially immutable. + */ + public static Clob createClob(Reader reader, int length) { + return new ClobImpl(reader, length); } + } |