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-04-06 10:11:42
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql In directory sc8-pr-cvs1:/tmp/cvs-serv26833/hql Modified Files: SelectParser.java Log Message: * reworked CompositeUserType * improved some exception handling Index: SelectParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/SelectParser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SelectParser.java 3 Mar 2003 09:31:05 -0000 1.8 --- SelectParser.java 6 Apr 2003 10:11:09 -0000 1.9 *************** *** 71,75 **** } else if ( StringHelper.OPEN_PAREN.equals(token) ) { ! if (holderClass!=null && !ready) { //opening paren in new Foo ( ... ) ready=true; --- 71,75 ---- } else if ( StringHelper.OPEN_PAREN.equals(token) ) { ! if (!aggregate && holderClass!=null && !ready) { //opening paren in new Foo ( ... ) ready=true; |
From: <one...@us...> - 2003-04-06 10:11:42
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine In directory sc8-pr-cvs1:/tmp/cvs-serv26833/engine Modified Files: SessionImplementor.java Log Message: * reworked CompositeUserType * improved some exception handling Index: SessionImplementor.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/SessionImplementor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SessionImplementor.java 2 Apr 2003 01:12:20 -0000 1.10 --- SessionImplementor.java 6 Apr 2003 10:11:09 -0000 1.11 *************** *** 2,6 **** package net.sf.hibernate.engine; - import java.sql.SQLException; import java.util.Iterator; import java.util.List; --- 2,5 ---- *************** *** 23,28 **** * Defines the internal contract between the <tt>Session</tt> and other parts of * Hibernate such as implementors of <tt>Type</tt> or <tt>ClassPersister</tt>. ! * @see net.sf.hibernate.Session ! * @see net.sf.hibernate.impl.SessionImpl */ public interface SessionImplementor extends Session { --- 22,28 ---- * Defines the internal contract between the <tt>Session</tt> and other parts of * Hibernate such as implementors of <tt>Type</tt> or <tt>ClassPersister</tt>. ! * ! * @see net.sf.hibernate.Session the interface to the application ! * @see net.sf.hibernate.impl.SessionImpl the actual implementation */ public interface SessionImplementor extends Session { *************** *** 61,65 **** * Initialize the collection (if not already initialized) */ ! public void initialize(PersistentCollection collection, boolean writing) throws HibernateException, SQLException; /** * Is this the "inverse" end of a bidirectional association? --- 61,65 ---- * Initialize the collection (if not already initialized) */ ! public void initialize(PersistentCollection collection, boolean writing) throws HibernateException; /** * Is this the "inverse" end of a bidirectional association? *************** *** 71,80 **** * This method may create a new proxy or return an existing proxy. */ ! public Object internalLoad(Class persistentClass, Serializable id) throws SQLException, HibernateException; /** * Load an instance without checking if it was deleted. If it does not exist, return <tt>null</tt>. * Do not create a proxy (but do return any existing proxy). */ ! public Object internalLoadOneToOne(Class persistentClass, Serializable id) throws SQLException, HibernateException; /** * Load an instance immediately. Do not return a proxy. --- 71,80 ---- * This method may create a new proxy or return an existing proxy. */ ! public Object internalLoad(Class persistentClass, Serializable id) throws HibernateException; /** * Load an instance without checking if it was deleted. If it does not exist, return <tt>null</tt>. * Do not create a proxy (but do return any existing proxy). */ ! public Object internalLoadOneToOne(Class persistentClass, Serializable id) throws HibernateException; /** * Load an instance immediately. Do not return a proxy. *************** *** 144,148 **** * Perform the second step of 2-phase load (ie. fully initialize the entity instance) */ ! public void initializeEntity(Object object) throws HibernateException, SQLException; /** --- 144,148 ---- * Perform the second step of 2-phase load (ie. fully initialize the entity instance) */ ! public void initializeEntity(Object object) throws HibernateException; /** |
From: <one...@us...> - 2003-04-06 10:11:42
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv26833/collection Modified Files: ArrayHolder.java Bag.java CollectionPersister.java List.java Map.java PersistentCollection.java Set.java SortedMap.java SortedSet.java Log Message: * reworked CompositeUserType * improved some exception handling Index: ArrayHolder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ArrayHolder.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ArrayHolder.java 2 Apr 2003 01:06:52 -0000 1.11 --- ArrayHolder.java 6 Apr 2003 10:11:07 -0000 1.12 *************** *** 159,163 **** //Arrays have to do things a bit differently. ! public Object getInitialValue(boolean lazy) throws SQLException, HibernateException { super.getInitialValue(false); session.addArrayHolder(this); --- 159,163 ---- //Arrays have to do things a bit differently. ! public Object getInitialValue(boolean lazy) throws HibernateException { super.getInitialValue(false); session.addArrayHolder(this); *************** *** 175,179 **** public ArrayHolder(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) ! throws HibernateException, SQLException { super(session); Serializable[] cached = (Serializable[]) disassembled; --- 175,179 ---- public ArrayHolder(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) ! throws HibernateException { super(session); Serializable[] cached = (Serializable[]) disassembled; Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Bag.java 6 Mar 2003 11:12:09 -0000 1.9 --- Bag.java 6 Apr 2003 10:11:07 -0000 1.10 *************** *** 161,165 **** */ public Bag(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) ! throws HibernateException, SQLException { super(session); beforeInitialize(persister); --- 161,165 ---- */ public Bag(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) ! throws HibernateException { super(session); beforeInitialize(persister); Index: CollectionPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/CollectionPersister.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** CollectionPersister.java 2 Apr 2003 01:06:52 -0000 1.17 --- CollectionPersister.java 6 Apr 2003 10:11:07 -0000 1.18 *************** *** 224,228 **** } ! public PersistentCollection getCachedCollection(Serializable id, Object owner, SessionImplementor s) throws HibernateException, SQLException { if (cache==null) { return null; --- 224,228 ---- } ! public PersistentCollection getCachedCollection(Serializable id, Object owner, SessionImplementor s) throws HibernateException { if (cache==null) { return null; Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** List.java 6 Mar 2003 11:12:10 -0000 1.10 --- List.java 6 Apr 2003 10:11:07 -0000 1.11 *************** *** 317,321 **** public List(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) ! throws HibernateException, SQLException { super(session); beforeInitialize(persister); --- 317,321 ---- public List(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) ! throws HibernateException { super(session); beforeInitialize(persister); Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Map.java 6 Mar 2003 11:12:11 -0000 1.10 --- Map.java 6 Apr 2003 10:11:07 -0000 1.11 *************** *** 310,314 **** public Map(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) ! throws HibernateException, SQLException { super(session); beforeInitialize(persister); --- 310,314 ---- public Map(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) ! throws HibernateException { super(session); beforeInitialize(persister); Index: PersistentCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/PersistentCollection.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PersistentCollection.java 2 Apr 2003 01:06:52 -0000 1.11 --- PersistentCollection.java 6 Apr 2003 10:11:07 -0000 1.12 *************** *** 114,118 **** // As far as every client is concerned, the collection is // loaded after this call! (Actually its done lazily) ! public Object getInitialValue(boolean lazy) throws SQLException, HibernateException { if ( !lazy ) { session.initialize(this, false); --- 114,118 ---- // As far as every client is concerned, the collection is // loaded after this call! (Actually its done lazily) ! public Object getInitialValue(boolean lazy) throws HibernateException { if ( !lazy ) { session.initialize(this, false); Index: Set.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Set.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Set.java 2 Apr 2003 01:06:53 -0000 1.10 --- Set.java 6 Apr 2003 10:11:07 -0000 1.11 *************** *** 72,76 **** directlyAccessible = true; } ! public Set(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException, SQLException { super(session); beforeInitialize(persister); --- 72,76 ---- directlyAccessible = true; } ! public Set(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException { super(session); beforeInitialize(persister); Index: SortedMap.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedMap.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SortedMap.java 15 Feb 2003 01:00:51 -0000 1.7 --- SortedMap.java 6 Apr 2003 10:11:07 -0000 1.8 *************** *** 4,8 **** import java.io.Serializable; - import java.sql.SQLException; import java.util.Iterator; import java.util.TreeMap; --- 4,7 ---- *************** *** 39,43 **** public SortedMap(SessionImplementor session, CollectionPersister persister, Comparator comparator, Serializable disassembled, Object owner) ! throws HibernateException, SQLException { super(session); this.comparator=comparator; --- 38,42 ---- public SortedMap(SessionImplementor session, CollectionPersister persister, Comparator comparator, Serializable disassembled, Object owner) ! throws HibernateException { super(session); this.comparator=comparator; Index: SortedSet.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedSet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SortedSet.java 19 Feb 2003 01:51:30 -0000 1.8 --- SortedSet.java 6 Apr 2003 10:11:08 -0000 1.9 *************** *** 3,7 **** import java.io.Serializable; - import java.sql.SQLException; import java.util.Iterator; import java.util.TreeMap; --- 3,6 ---- *************** *** 141,145 **** Serializable disassembled, Object owner) ! throws HibernateException, SQLException { this(session); --- 140,144 ---- Serializable disassembled, Object owner) ! throws HibernateException { this(session); |
From: <one...@us...> - 2003-04-06 10:11:40
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv26833 Modified Files: UserType.java Log Message: * reworked CompositeUserType * improved some exception handling Index: UserType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/UserType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** UserType.java 6 Apr 2003 02:28:55 -0000 1.6 --- UserType.java 6 Apr 2003 10:11:07 -0000 1.7 *************** *** 27,30 **** --- 27,33 ---- * must be serializable.<br> * <br> + * <tt>CompositeUserType</tt> provides an extended version of + * this interface that is useful for more complex cases.<br> + * <br> * Alternatively, custom types could implement <tt>Type</tt> * directly or extend one of the abstract classes in *************** *** 33,36 **** --- 36,40 ---- * package. * + * @see CompositeUserType for more complex cases * @see net.sf.hibernate.type.Type */ *************** *** 61,65 **** * @return boolean */ ! public boolean equals(Object x, Object y); /** --- 65,69 ---- * @return boolean */ ! public boolean equals(Object x, Object y) throws HibernateException; /** *************** *** 95,103 **** * collections. * - * @param value generally a collection element or entity field - * @param session * @return Object a copy */ ! public Object deepCopy(Object value); /** --- 99,105 ---- * collections. * * @return Object a copy */ ! public Object deepCopy(Object value) throws HibernateException; /** |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type In directory sc8-pr-cvs1:/tmp/cvs-serv26833/type Modified Files: AbstractType.java ArrayType.java BagType.java ComponentType.java CompositeCustomType.java CustomType.java EntityType.java ListType.java ManyToOneType.java MapType.java ObjectType.java OneToOneType.java PersistentCollectionType.java SetType.java SortedMapType.java SortedSetType.java Type.java Log Message: * reworked CompositeUserType * improved some exception handling Index: AbstractType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/AbstractType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractType.java 19 Feb 2003 02:02:07 -0000 1.7 --- AbstractType.java 6 Apr 2003 10:11:12 -0000 1.8 *************** *** 42,46 **** } ! public Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException, SQLException { if ( cached==null ) { return null; --- 42,46 ---- } ! public Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException { if ( cached==null ) { return null; *************** *** 66,70 **** public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) ! throws HibernateException, SQLException { return value; } --- 66,70 ---- public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) ! throws HibernateException { return value; } Index: ArrayType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ArrayType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ArrayType.java 9 Feb 2003 07:41:16 -0000 1.7 --- ArrayType.java 6 Apr 2003 10:11:12 -0000 1.8 *************** *** 67,71 **** Serializable disassembled, Object owner) ! throws HibernateException, SQLException { return new ArrayHolder(session, persister, disassembled, owner); --- 67,71 ---- Serializable disassembled, Object owner) ! throws HibernateException { return new ArrayHolder(session, persister, disassembled, owner); Index: BagType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BagType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BagType.java 9 Feb 2003 07:41:16 -0000 1.7 --- BagType.java 6 Apr 2003 10:11:12 -0000 1.8 *************** *** 3,7 **** import java.io.Serializable; - import java.sql.SQLException; import net.sf.hibernate.HibernateException; --- 3,6 ---- *************** *** 38,42 **** Serializable disassembled, Object owner) ! throws HibernateException, SQLException { return new Bag(session, persister, disassembled, owner); --- 37,41 ---- Serializable disassembled, Object owner) ! throws HibernateException { return new Bag(session, persister, disassembled, owner); Index: ComponentType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ComponentType.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ComponentType.java 6 Apr 2003 02:28:58 -0000 1.11 --- ComponentType.java 6 Apr 2003 10:11:12 -0000 1.12 *************** *** 313,317 **** public Object assemble(Serializable object, SessionImplementor session, Object owner) ! throws HibernateException, SQLException { if ( object==null ) { --- 313,317 ---- public Object assemble(Serializable object, SessionImplementor session, Object owner) ! throws HibernateException { if ( object==null ) { Index: CompositeCustomType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/CompositeCustomType.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CompositeCustomType.java 6 Apr 2003 02:28:58 -0000 1.1 --- CompositeCustomType.java 6 Apr 2003 10:11:12 -0000 1.2 *************** *** 1,26 **** package net.sf.hibernate.type; import net.sf.hibernate.CompositeUserType; import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; import net.sf.hibernate.engine.Cascades; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.engine.Cascades.CascadeStyle; import net.sf.hibernate.loader.OuterJoinLoader; ! public class CompositeCustomType ! extends CustomType implements AbstractComponentType { public CompositeCustomType(Class userTypeClass) throws MappingException { ! super(userTypeClass); } public Type[] getSubtypes() { ! return ( (CompositeUserType) getUserType() ).getPropertyTypes(); } public String[] getPropertyNames() { ! return ( (CompositeUserType) getUserType() ).getPropertyNames(); } --- 1,55 ---- + //$Id$ package net.sf.hibernate.type; + import java.io.Serializable; + import java.sql.PreparedStatement; + import java.sql.ResultSet; + import java.sql.SQLException; + + import org.apache.commons.logging.LogFactory; + import net.sf.hibernate.CompositeUserType; import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; import net.sf.hibernate.engine.Cascades; + import net.sf.hibernate.engine.Mapping; + import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.engine.Cascades.CascadeStyle; import net.sf.hibernate.loader.OuterJoinLoader; ! public class CompositeCustomType extends AbstractType implements AbstractComponentType { + + private final CompositeUserType userType; + private final String name; public CompositeCustomType(Class userTypeClass) throws MappingException { ! name = userTypeClass.getName(); ! ! try { ! userType = (CompositeUserType) userTypeClass.newInstance(); ! } ! catch (InstantiationException ie) { ! throw new MappingException( "Cannot instantiate custom type: " + userTypeClass.getName() ); ! } ! catch (IllegalAccessException iae) { ! throw new MappingException( "IllegalAccessException trying to instantiate custom type: " + userTypeClass.getName() ); ! } ! catch (ClassCastException cce) { ! throw new MappingException( userTypeClass.getName() + " must implement net.sf.hibernate.UserType" ); ! } ! ! if ( !Serializable.class.isAssignableFrom( userType.returnedClass() ) ) { ! LogFactory.getLog(CustomType.class).warn("custom type does not implement Serializable: " + userTypeClass); ! } } public Type[] getSubtypes() { ! return userType.getPropertyTypes(); } public String[] getPropertyNames() { ! return userType.getPropertyNames(); } *************** *** 39,48 **** throws HibernateException { ! throw new UnsupportedOperationException(); } public Object getPropertyValue(Object component, int i, SessionImplementor session) throws HibernateException { ! return ( (CompositeUserType) getUserType() ).getPropertyValue(component, i); } --- 68,79 ---- throws HibernateException { ! for (int i=0; i<values.length; i++) { ! userType.setPropertyValue( component, i, values[i] ); ! } } public Object getPropertyValue(Object component, int i, SessionImplementor session) throws HibernateException { ! return userType.getPropertyValue(component, i); } *************** *** 52,60 **** public int enableJoinedFetch(int i) { ! return OuterJoinLoader.LAZY; } public boolean isComponentType() { return true; } --- 83,174 ---- public int enableJoinedFetch(int i) { ! return OuterJoinLoader.AUTO; } public boolean isComponentType() { return true; + } + + public Object assemble( + Serializable cached, + SessionImplementor session, + Object owner) + throws HibernateException { + + return userType.assemble(cached, session, owner); + } + + public Object deepCopy(Object value) throws HibernateException { + return userType.deepCopy(value); + } + + public Serializable disassemble(Object value, SessionImplementor session) + throws HibernateException { + return userType.disassemble(value, session); + } + + public boolean equals(Object x, Object y) throws HibernateException { + return userType.equals(x, y); + } + + public int getColumnSpan(Mapping mapping) throws MappingException { + return userType.sqlTypes().length; + } + + public String getName() { + return name; + } + + public Class getReturnedClass() { + return userType.returnedClass(); + } + + public boolean hasNiceEquals() { + return false; + } + + public boolean isMutable() { + return userType.isMutable(); + } + + public Object nullSafeGet( + ResultSet rs, + String name, + SessionImplementor session, + Object owner) + throws HibernateException, SQLException { + + return userType.nullSafeGet(rs, new String[] {name}, session, owner); + } + + public Object nullSafeGet( + ResultSet rs, + String[] names, + SessionImplementor session, + Object owner) + throws HibernateException, SQLException { + + return userType.nullSafeGet(rs, names, session, owner); + } + + public void nullSafeSet( + PreparedStatement st, + Object value, + int index, + SessionImplementor session) + throws HibernateException, SQLException { + + userType.nullSafeSet(st, value, index, session); + + } + + public int[] sqlTypes(Mapping mapping) throws MappingException { + return userType.sqlTypes(); + } + + public String toXML(Object value, SessionFactoryImplementor factory) + throws HibernateException { + + return value.toString(); } Index: CustomType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/CustomType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CustomType.java 6 Apr 2003 02:28:58 -0000 1.7 --- CustomType.java 6 Apr 2003 10:11:12 -0000 1.8 *************** *** 80,84 **** * @see net.sf.hibernate.type.Type#equals(Object, Object) */ ! public boolean equals(Object x, Object y) { return userType.equals(x, y); } --- 80,84 ---- * @see net.sf.hibernate.type.Type#equals(Object, Object) */ ! public boolean equals(Object x, Object y) throws HibernateException { return userType.equals(x, y); } *************** *** 140,144 **** * @see net.sf.hibernate.type.Type#deepCopy(Object) */ ! public Object deepCopy(Object value) { return userType.deepCopy(value); } --- 140,144 ---- * @see net.sf.hibernate.type.Type#deepCopy(Object) */ ! public Object deepCopy(Object value) throws HibernateException { return userType.deepCopy(value); } Index: EntityType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/EntityType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** EntityType.java 19 Feb 2003 02:02:07 -0000 1.7 --- EntityType.java 6 Apr 2003 10:11:12 -0000 1.8 *************** *** 84,88 **** } ! public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException, SQLException { return resolveIdentifier(oid, session, owner); } --- 84,88 ---- } ! public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException { return resolveIdentifier(oid, session, owner); } Index: ListType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ListType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ListType.java 9 Feb 2003 07:41:16 -0000 1.7 --- ListType.java 6 Apr 2003 10:11:12 -0000 1.8 *************** *** 3,7 **** import java.io.Serializable; - import java.sql.SQLException; import net.sf.hibernate.HibernateException; --- 3,6 ---- *************** *** 34,38 **** Serializable disassembled, Object owner) ! throws HibernateException, SQLException { return new List(session, persister, disassembled, owner); --- 33,37 ---- Serializable disassembled, Object owner) ! throws HibernateException { return new List(session, persister, disassembled, owner); Index: ManyToOneType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ManyToOneType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ManyToOneType.java 19 Feb 2003 02:02:07 -0000 1.5 --- ManyToOneType.java 6 Apr 2003 10:11:13 -0000 1.6 *************** *** 32,36 **** public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { session.getFactory().getIdentifierType( getPersistentClass() ) ! .nullSafeSet(st, getIdentifier(value, session), index, session); } --- 32,36 ---- public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { session.getFactory().getIdentifierType( getPersistentClass() ) ! .nullSafeSet(st, getIdentifier(value, session), index, session); } *************** *** 54,58 **** public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) ! throws HibernateException, SQLException { if (value==null) { --- 54,58 ---- public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) ! throws HibernateException { if (value==null) { Index: MapType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/MapType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MapType.java 9 Feb 2003 07:41:16 -0000 1.7 --- MapType.java 6 Apr 2003 10:11:13 -0000 1.8 *************** *** 3,7 **** import java.io.Serializable; - import java.sql.SQLException; import java.util.Iterator; --- 3,6 ---- *************** *** 40,44 **** Serializable disassembled, Object owner) ! throws HibernateException, SQLException { return new Map(session, persister, disassembled, owner); --- 39,43 ---- Serializable disassembled, Object owner) ! throws HibernateException { return new Map(session, persister, disassembled, owner); Index: ObjectType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ObjectType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ObjectType.java 6 Apr 2003 02:28:59 -0000 1.7 --- ObjectType.java 6 Apr 2003 10:11:13 -0000 1.8 *************** *** 165,169 **** SessionImplementor session, Object owner) ! throws HibernateException, SQLException { ObjectTypeCacheEntry e = (ObjectTypeCacheEntry) cached; --- 165,169 ---- SessionImplementor session, Object owner) ! throws HibernateException { ObjectTypeCacheEntry e = (ObjectTypeCacheEntry) cached; Index: OneToOneType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/OneToOneType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** OneToOneType.java 9 Feb 2003 07:41:16 -0000 1.6 --- OneToOneType.java 6 Apr 2003 10:11:13 -0000 1.7 *************** *** 62,66 **** } ! public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) throws HibernateException, SQLException { if (value==null) return null; --- 62,66 ---- } ! public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) throws HibernateException { if (value==null) return null; *************** *** 70,75 **** return isNullable() ? ! session.internalLoadOneToOne(clazz, id) : ! session.internalLoad(clazz, id); } --- 70,75 ---- return isNullable() ? ! session.internalLoadOneToOne(clazz, id) : ! session.internalLoad(clazz, id); } Index: PersistentCollectionType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/PersistentCollectionType.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PersistentCollectionType.java 9 Feb 2003 07:41:16 -0000 1.8 --- PersistentCollectionType.java 6 Apr 2003 10:11:13 -0000 1.9 *************** *** 49,53 **** } ! public Object getCollection(Serializable id, Object owner, SessionImplementor session) throws HibernateException, SQLException { CollectionPersister persister = session.getFactory().getCollectionPersister(role); --- 49,53 ---- } ! public Object getCollection(Serializable id, Object owner, SessionImplementor session) throws HibernateException { CollectionPersister persister = session.getFactory().getCollectionPersister(role); *************** *** 110,114 **** } ! public Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException, SQLException { return resolveIdentifier(cached, session, owner); } --- 110,114 ---- } ! public Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException { return resolveIdentifier(cached, session, owner); } *************** *** 155,159 **** public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) ! throws HibernateException, SQLException { if (value==null) { --- 155,159 ---- public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) ! throws HibernateException { if (value==null) { *************** *** 173,177 **** CollectionPersister persister, Serializable disassembled, ! Object owner) throws HibernateException, SQLException; } --- 173,177 ---- CollectionPersister persister, Serializable disassembled, ! Object owner) throws HibernateException; } Index: SetType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SetType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SetType.java 9 Feb 2003 07:41:16 -0000 1.7 --- SetType.java 6 Apr 2003 10:11:13 -0000 1.8 *************** *** 3,7 **** import java.io.Serializable; - import java.sql.SQLException; import net.sf.hibernate.HibernateException; --- 3,6 ---- *************** *** 33,37 **** CollectionPersister persister, Serializable disassembled, ! Object owner) throws HibernateException, SQLException { return new Set(session, persister, disassembled, owner); --- 32,36 ---- CollectionPersister persister, Serializable disassembled, ! Object owner) throws HibernateException { return new Set(session, persister, disassembled, owner); Index: SortedMapType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SortedMapType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SortedMapType.java 9 Feb 2003 07:41:16 -0000 1.7 --- SortedMapType.java 6 Apr 2003 10:11:13 -0000 1.8 *************** *** 4,8 **** import java.io.Serializable; - import java.sql.SQLException; import java.util.Comparator; --- 4,7 ---- *************** *** 41,45 **** Serializable disassembled, Object owner) ! throws HibernateException, SQLException { return new SortedMap(session, persister, comparator, disassembled, owner); --- 40,44 ---- Serializable disassembled, Object owner) ! throws HibernateException { return new SortedMap(session, persister, comparator, disassembled, owner); Index: SortedSetType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SortedSetType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SortedSetType.java 9 Feb 2003 07:41:16 -0000 1.7 --- SortedSetType.java 6 Apr 2003 10:11:13 -0000 1.8 *************** *** 4,8 **** import java.io.Serializable; - import java.sql.SQLException; import java.util.Comparator; --- 4,7 ---- *************** *** 40,44 **** CollectionPersister persister, Serializable disassembled, ! Object owner) throws HibernateException, SQLException { return new SortedSet(session, persister, comparator, disassembled, owner); --- 39,43 ---- CollectionPersister persister, Serializable disassembled, ! Object owner) throws HibernateException { return new SortedSet(session, persister, comparator, disassembled, owner); Index: Type.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/Type.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Type.java 19 Feb 2003 02:02:09 -0000 1.8 --- Type.java 6 Apr 2003 10:11:13 -0000 1.9 *************** *** 201,205 **** * @return the the object */ ! public Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException, SQLException; /** --- 201,205 ---- * @return the the object */ ! public Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException; /** *************** *** 238,242 **** * @throws SQLException */ ! public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) throws HibernateException, SQLException; } --- 238,242 ---- * @throws SQLException */ ! public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) throws HibernateException; } |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv26833/test Modified Files: DoubleStringType.java FooBarTest.java Glarch.hbm.xml Glarch.java MultiTableTest.java Qux.hbm.xml Log Message: * reworked CompositeUserType * improved some exception handling Index: DoubleStringType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/DoubleStringType.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DoubleStringType.java 6 Apr 2003 02:28:58 -0000 1.4 --- DoubleStringType.java 6 Apr 2003 10:11:11 -0000 1.5 *************** *** 2,5 **** --- 2,6 ---- package net.sf.hibernate.test; + import java.io.Serializable; import java.sql.PreparedStatement; import java.sql.ResultSet; *************** *** 10,13 **** --- 11,15 ---- import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; + import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.type.Type; *************** *** 41,45 **** public boolean isMutable() { return true; } ! public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { --- 43,47 ---- public boolean isMutable() { return true; } ! public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { *************** *** 50,54 **** } ! public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { --- 52,56 ---- } ! public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { *************** *** 77,80 **** --- 79,94 ---- ( (String[]) component )[property] = (String) value; + } + + public Object assemble( + Serializable cached, + SessionImplementor session, + Object owner) { + + return deepCopy(cached); + } + + public Serializable disassemble(Object value, SessionImplementor session) { + return (Serializable) deepCopy(value); } Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** FooBarTest.java 6 Apr 2003 02:28:58 -0000 1.49 --- FooBarTest.java 6 Apr 2003 10:11:11 -0000 1.50 *************** *** 123,126 **** --- 123,158 ---- } + public void testCustom() throws Exception { + Glarch g = new Glarch(); + Multiplicity m = new Multiplicity(); + m.count = 12; + m.glarch = g; + g.setMultiple(m); + Session s = sessions.openSession(); + Serializable gid = s.save(g); + s.flush(); + s.connection().commit(); + s.close(); + + s = sessions.openSession(); + g = (Glarch) s.find("from Glarch g where g.multiple.glarch=g and g.multiple.count=12").get(0); + assertTrue( g.getMultiple()!=null ); + assertEquals( g.getMultiple().count, 12 ); + assertSame(g.getMultiple().glarch, g); + s.flush(); + s.connection().commit(); + s.close(); + + s = sessions.openSession(); + g = (Glarch) s.load(Glarch.class, gid); + assertTrue( g.getMultiple()!=null ); + assertEquals( g.getMultiple().count, 12 ); + assertSame(g.getMultiple().glarch, g); + s.delete(g); + s.flush(); + s.connection().commit(); + s.close(); + } + public void testNamedParams() throws Exception { Bar bar = new Bar(); *************** *** 454,457 **** --- 486,495 ---- List list = s.find("select new Result(foo.string, foo.long, foo.integer) from foo in class Foo"); assertTrue( list.size()==2 && ( list.get(0) instanceof Result ) && ( list.get(1) instanceof Result ) ); + list = s.find("select new Result( baz.name, foo.long, count(elements(baz.fooArray)) ) from Baz baz join baz.fooArray foo group by baz.name, foo.long"); + assertTrue( list.size()==1 && ( list.get(0) instanceof Result ) ); + Result r = ((Result) list.get(0) ); + assertEquals( r.getName(), baz.getName() ); + assertEquals( r.getCount(), 1 ); + assertEquals( r.getAmount(), foos[1].getLong().longValue() ); s.find("select max( elements(bar.baz.fooArray) ) from Bar as bar"); Index: Glarch.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Glarch.hbm.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Glarch.hbm.xml 2 Apr 2003 13:10:38 -0000 1.11 --- Glarch.hbm.xml 6 Apr 2003 10:11:11 -0000 1.12 *************** *** 54,57 **** --- 54,61 ---- <column name="any_class"/> </property> + <property name="multiple" type="net.sf.hibernate.test.MultiplicityType"> + <column name="count_"/> + <column name="glarch_"/> + </property> </class> Index: Glarch.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Glarch.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Glarch.java 20 Mar 2003 13:59:10 -0000 1.8 --- Glarch.java 6 Apr 2003 10:11:11 -0000 1.9 *************** *** 34,37 **** --- 34,38 ---- private Object any; private int x; + private Multiplicity multiple; public int getX() { *************** *** 216,219 **** --- 217,234 ---- public void setAny(Object any) { this.any = any; + } + + /** + * @return + */ + public Multiplicity getMultiple() { + return multiple; + } + + /** + * @param multiplicity + */ + public void setMultiple(Multiplicity multiplicity) { + multiple = multiplicity; } Index: MultiTableTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MultiTableTest.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** MultiTableTest.java 6 Apr 2003 02:28:58 -0000 1.12 --- MultiTableTest.java 6 Apr 2003 10:11:11 -0000 1.13 *************** *** 107,112 **** public void testMultiTable() throws Exception { - if ( dialect instanceof SybaseDialect ) return; - Session s = sessions.openSession(); Transaction t = s.beginTransaction(); --- 107,110 ---- *************** *** 119,127 **** simp.setName("simp"); //simp.setCount(132); ! s.save( multi, new Long(123) ); ! s.save( simp, new Long(1234) ); SubMulti sm = new SubMulti(); sm.setAmount(66.5f); ! s.save( sm, new Long(2) ); t.commit(); s.close(); --- 117,142 ---- simp.setName("simp"); //simp.setCount(132); ! Serializable mid; ! Serializable sid; ! if ( dialect instanceof SybaseDialect ) { ! mid = s.save(multi); ! sid = s.save(simp); ! } ! else { ! mid = new Long(123); ! s.save(multi, mid); ! sid = new Long(1234); ! s.save(simp, sid); ! } SubMulti sm = new SubMulti(); sm.setAmount(66.5f); ! Serializable smid; ! if (dialect instanceof SybaseDialect) { ! smid = s.save(sm); ! } ! else { ! smid = new Long(2); ! s.save(sm, smid); ! } t.commit(); s.close(); *************** *** 132,140 **** //multi.setCount( multi.getCount() + 1 ); multi.setName("new name"); ! s.update( multi, new Long(123) ); simp.setName("new name"); ! s.update( simp, new Long(1234) ); sm.setAmount(456.7f); ! s.update( sm, new Long(2) ); t.commit(); s.close(); --- 147,155 ---- //multi.setCount( multi.getCount() + 1 ); multi.setName("new name"); ! s.update(multi, mid); simp.setName("new name"); ! s.update(simp, sid); sm.setAmount(456.7f); ! s.update(sm, smid); t.commit(); s.close(); *************** *** 142,146 **** s = sessions.openSession(); t = s.beginTransaction(); ! multi = (Multi) s.load( Multi.class, new Long(123) ); assertTrue( multi.getExtraProp().equals("extra2") ); multi.setExtraProp( multi.getExtraProp() + "3" ); --- 157,161 ---- s = sessions.openSession(); t = s.beginTransaction(); ! multi = (Multi) s.load(Multi.class, mid); assertTrue( multi.getExtraProp().equals("extra2") ); multi.setExtraProp( multi.getExtraProp() + "3" ); *************** *** 148,152 **** assertTrue( multi.getName().equals("new name") ); multi.setName("newer name"); ! sm = (SubMulti) s.load( SubMulti.class, new Long(2) ); assertTrue( sm.getAmount()==456.7f ); sm.setAmount(23423f); --- 163,167 ---- assertTrue( multi.getName().equals("new name") ); multi.setName("newer name"); ! sm = (SubMulti) s.load(SubMulti.class, smid); assertTrue( sm.getAmount()==456.7f ); sm.setAmount(23423f); *************** *** 156,161 **** s = sessions.openSession(); t = s.beginTransaction(); ! multi = (Multi) s.load( Simple.class, new Long(123) ); ! simp = (Simple) s.load( Simple.class, new Long(1234) ); assertTrue( ! (simp instanceof Multi) ); assertTrue( multi instanceof Multi ); --- 171,176 ---- s = sessions.openSession(); t = s.beginTransaction(); ! multi = (Multi) s.load(Simple.class, mid); ! simp = (Simple) s.load(Simple.class, sid); assertTrue( ! (simp instanceof Multi) ); assertTrue( multi instanceof Multi ); *************** *** 192,196 **** ); assertTrue( ! s.find("from m in class Simple where m.class = Multi").size()==2 ); assertTrue( --- 207,211 ---- ); assertTrue( ! s.find("from m in class Simple where m.class = Multi").size()==1 ); assertTrue( *************** *** 213,218 **** s = sessions.openSession(); t = s.beginTransaction(); ! multi = (Multi) s.load( Simple.class, new Long(123), LockMode.UPGRADE ); ! simp = (Simple) s.load( Simple.class, new Long(1234) ); s.lock(simp, LockMode.UPGRADE_NOWAIT); t.commit(); --- 228,233 ---- s = sessions.openSession(); t = s.beginTransaction(); ! multi = (Multi) s.load(Simple.class, mid, LockMode.UPGRADE); ! simp = (Simple) s.load(Simple.class, sid); s.lock(simp, LockMode.UPGRADE_NOWAIT); t.commit(); *************** *** 221,225 **** s = sessions.openSession(); t = s.beginTransaction(); ! s.update( multi, new Long(123) ); s.delete(multi); assertTrue( s.delete("from s in class Simple")==2); --- 236,240 ---- s = sessions.openSession(); t = s.beginTransaction(); ! s.update(multi, mid); s.delete(multi); assertTrue( s.delete("from s in class Simple")==2); Index: Qux.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Qux.hbm.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Qux.hbm.xml 6 Apr 2003 02:28:58 -0000 1.7 --- Qux.hbm.xml 6 Apr 2003 10:11:12 -0000 1.8 *************** *** 1,5 **** <?xml version="1.0"?> <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > ! <hibernate-mapping schema="dbo"> <class name="net.sf.hibernate.test.Qux" table="quux" proxy="net.sf.hibernate.test.Qux"> <!----> --- 1,5 ---- <?xml version="1.0"?> <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > ! <hibernate-mapping> <class name="net.sf.hibernate.test.Qux" table="quux" proxy="net.sf.hibernate.test.Qux"> <!----> |
From: <one...@us...> - 2003-04-06 10:11:14
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql In directory sc8-pr-cvs1:/tmp/cvs-serv26833/sql Modified Files: ANSICaseFragment.java DecodeCaseFragment.java Log Message: * reworked CompositeUserType * improved some exception handling Index: ANSICaseFragment.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql/ANSICaseFragment.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ANSICaseFragment.java 15 Mar 2003 04:38:17 -0000 1.2 --- ANSICaseFragment.java 6 Apr 2003 10:11:11 -0000 1.3 *************** *** 1 **** ! //$Id$ package net.sf.hibernate.sql; import java.util.Iterator; import java.util.Map; import net.sf.hibernate.util.StringHelper; import org.apache.commons.collections.SequencedHashMap; /** * Represents an SQL <tt>case when .... then .... end as ...</tt> */ public class ANSICaseFragment extends CaseFragment { private String returnColumnName; private Map cases = new SequencedHashMap(); public CaseFragment setReturnColumnName(String returnColumnName) { this.returnColumnName = returnColumnName; return this; } public CaseFragment setReturnColumnName(String returnColumnName, String suffix) { return setReturnColumnName( new Alias(suffix).toAliasString(returnColumnName) ); } public CaseFragment addWhenColumnNotNull(String alias, String columnName, String value) { cases.put( alias + StringHelper.DOT + columnName + " is not null", value ); return this; } public String toFragmentString() { StringBuffer buf = new StringBuffer( cases.size() * 15 + 10 ); buf.append("case"); Iterator iter = cases.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = (Map.Entry) iter.next(); buf.append(" when ") .append( me.getKey() ) .append(" then ") .append( me.getValue() ); } return buf.append(" end as ") .append(returnColumnName) .toString(); } } \ No newline at end of file --- 1 ---- ! //$Id$ package net.sf.hibernate.sql; import java.util.Iterator; import java.util.Map; import net.sf.hibernate.util.StringHelper; import org.apache.commons.collections.SequencedHashMap; /** * Represents an SQL <tt>case when .... then .... end as ...</tt> */ public class ANSICaseFragment extends CaseFragment { private String returnColumnName; private Map cases = new SequencedHashMap(); public CaseFragment setReturnColumnName(String returnColumnName) { this.returnColumnName = returnColumnName; return this; } public CaseFragment setReturnColumnName(String returnColumnName, String suffix) { return setReturnColumnName( new Alias(suffix).toAliasString(returnColumnName) ); } public CaseFragment addWhenColumnNotNull(String alias, String columnName, String value) { cases.put( alias + StringHelper.DOT + columnName + " is not null", value ); return this; } public String toFragmentString() { StringBuffer buf = new StringBuffer( cases.size() * 15 + 10 ); buf.append("case"); Iterator iter = cases.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = (Map.Entry) iter.next(); buf.append(" when ") .append( me.getKey() ) .append(" then ") .append( me.getValue() ); } buf.append(" end"); if (returnColumnName!=null) { buf.append(" as ") .append(returnColumnName); } return buf.toString(); } } \ No newline at end of file Index: DecodeCaseFragment.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql/DecodeCaseFragment.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DecodeCaseFragment.java 15 Mar 2003 04:38:17 -0000 1.2 --- DecodeCaseFragment.java 6 Apr 2003 10:11:11 -0000 1.3 *************** *** 1 **** ! //$Id$ package net.sf.hibernate.sql; import java.util.Iterator; import java.util.Map; import net.sf.hibernate.util.StringHelper; import org.apache.commons.collections.SequencedHashMap; /** * Represents an SQL <tt>decode( pkvalue, key1, 1, key2, 2, ..., 0)</tt> */ public class DecodeCaseFragment extends CaseFragment { private String returnColumnName; private Map cases = new SequencedHashMap(); public CaseFragment setReturnColumnName(String returnColumnName) { this.returnColumnName = returnColumnName; return this; } public CaseFragment setReturnColumnName(String returnColumnName, String suffix) { return setReturnColumnName( new Alias(suffix).toAliasString(returnColumnName) ); } public CaseFragment addWhenColumnNotNull(String alias, String columnName, String value) { cases.put( alias + StringHelper.DOT + columnName, value ); return this; } public String toFragmentString() { StringBuffer buf = new StringBuffer( cases.size() * 15 + 10 ); Iterator iter = cases.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = (Map.Entry) iter.next(); if (me.getValue().equals("0")) { buf.insert(0, me.getKey()); } else { buf.append(", ") .append( me.getKey() ) .append(", ") .append( me.getValue() ); } } return buf.insert(0, "decode (").append(",0 ) as ") .append(returnColumnName) .toString(); } } \ No newline at end of file --- 1 ---- ! //$Id$ package net.sf.hibernate.sql; import java.util.Iterator; import java.util.Map; import net.sf.hibernate.util.StringHelper; import org.apache.commons.collections.SequencedHashMap; /** * Represents an SQL <tt>decode( pkvalue, key1, 1, key2, 2, ..., 0)</tt> */ public class DecodeCaseFragment extends CaseFragment { private String returnColumnName; private Map cases = new SequencedHashMap(); public CaseFragment setReturnColumnName(String returnColumnName) { this.returnColumnName = returnColumnName; return this; } public CaseFragment setReturnColumnName(String returnColumnName, String suffix) { return setReturnColumnName( new Alias(suffix).toAliasString(returnColumnName) ); } public CaseFragment addWhenColumnNotNull(String alias, String columnName, String value) { cases.put( alias + StringHelper.DOT + columnName, value ); return this; } public String toFragmentString() { StringBuffer buf = new StringBuffer( cases.size() * 15 + 10 ); Iterator iter = cases.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = (Map.Entry) iter.next(); if (me.getValue().equals("0")) { buf.insert(0, me.getKey()); } else { buf.append(", ") .append( me.getKey() ) .append(", ") .append( me.getValue() ); } } buf.insert(0, "decode (").append(",0 )"); if (returnColumnName!=null) { buf.append(" as ") .append(returnColumnName); } return buf.toString(); } } \ No newline at end of file |
From: <one...@us...> - 2003-04-06 02:29:30
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg In directory sc8-pr-cvs1:/tmp/cvs-serv13138/cfg Modified Files: Binder.java Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema Index: Binder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg/Binder.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Binder.java 5 Apr 2003 07:13:37 -0000 1.12 --- Binder.java 6 Apr 2003 02:28:56 -0000 1.13 *************** *** 10,13 **** --- 10,14 ---- import net.sf.hibernate.MappingException; import net.sf.hibernate.engine.Cascades; + import net.sf.hibernate.id.PersistentIdentifierGenerator; import net.sf.hibernate.loader.OuterJoinLoader; import net.sf.hibernate.mapping.Any; *************** *** 212,216 **** "illegal use of an array as an identifier (arrays don't reimplement equals)" ); ! makeIdentifier(subnode, id); } else if ( "composite-id".equals(name) ) { --- 213,217 ---- "illegal use of an array as an identifier (arrays don't reimplement equals)" ); ! makeIdentifier(subnode, id, mappings); } else if ( "composite-id".equals(name) ) { *************** *** 229,233 **** model.setIdentifierProperty(prop); } ! makeIdentifier(subnode, id); } else if ( "version".equals(name) || "timestamp".equals(name) ) { --- 230,234 ---- model.setIdentifierProperty(prop); } ! makeIdentifier(subnode, id, mappings); } else if ( "version".equals(name) || "timestamp".equals(name) ) { *************** *** 712,716 **** } ! private static void makeIdentifier(Element node, Value model) throws MappingException { //GENERATOR --- 713,717 ---- } ! private static void makeIdentifier(Element node, Value model, Mappings mappings) throws MappingException { //GENERATOR *************** *** 720,723 **** --- 721,729 ---- Properties params = new Properties(); + + if ( mappings.getSchemaName()!=null ) { + params.setProperty( PersistentIdentifierGenerator.SCHEMA, mappings.getSchemaName() ); + } + Iterator iter = subnode.elementIterator("param"); while( iter.hasNext() ) { *************** *** 727,732 **** childNode.getText() ); ! } ! model.setIdentifierGeneratorProperties(params); } --- 733,738 ---- childNode.getText() ); ! } ! model.setIdentifierGeneratorProperties(params); } |
From: <one...@us...> - 2003-04-06 02:29:30
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql In directory sc8-pr-cvs1:/tmp/cvs-serv13138/hql Modified Files: PathExpressionParser.java Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema Index: PathExpressionParser.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/PathExpressionParser.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PathExpressionParser.java 3 Apr 2003 12:34:24 -0000 1.16 --- PathExpressionParser.java 6 Apr 2003 02:28:57 -0000 1.17 *************** *** 214,218 **** String path = getPropertyPath(); Type type = q.getPersisterForName(currentName).getPropertyType(path); ! if (type==null) throw new QueryException("could not resolve property type: " + path); return type; } --- 214,219 ---- String path = getPropertyPath(); Type type = q.getPersisterForName(currentName).getPropertyType(path); ! if (type==null) ! throw new QueryException("could not resolve property type: " + path); return type; } |
From: <one...@us...> - 2003-04-06 02:29:30
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine In directory sc8-pr-cvs1:/tmp/cvs-serv13138/engine Modified Files: Cascades.java Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema Index: Cascades.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/Cascades.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Cascades.java 24 Mar 2003 10:29:54 -0000 1.8 --- Cascades.java 6 Apr 2003 02:28:57 -0000 1.9 *************** *** 253,257 **** else if ( type.isComponentType() ) { AbstractComponentType ctype = ( (AbstractComponentType) type ); ! Object[] children = ctype.getPropertyValues(child); Type[] types = ctype.getSubtypes(); for ( int i=0; i<types.length; i++ ) { --- 253,257 ---- else if ( type.isComponentType() ) { AbstractComponentType ctype = ( (AbstractComponentType) type ); ! Object[] children = ctype.getPropertyValues(child, session); Type[] types = ctype.getSubtypes(); for ( int i=0; i<types.length; i++ ) { |
From: <one...@us...> - 2003-04-06 02:29:30
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv13138 Modified Files: Hibernate.java UserType.java hibernate-mapping-2.0.dtd Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema Index: Hibernate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Hibernate.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Hibernate.java 29 Mar 2003 04:08:46 -0000 1.9 --- Hibernate.java 6 Apr 2003 02:28:55 -0000 1.10 *************** *** 24,27 **** --- 24,28 ---- import net.sf.hibernate.type.ClassType; import net.sf.hibernate.type.ClobType; + import net.sf.hibernate.type.CompositeCustomType; import net.sf.hibernate.type.CurrencyType; import net.sf.hibernate.type.CustomType; *************** *** 201,205 **** */ public static Type custom(Class userTypeClass) throws HibernateException { ! return new CustomType(userTypeClass); } --- 202,211 ---- */ public static Type custom(Class userTypeClass) throws HibernateException { ! if ( CompositeUserType.class.isAssignableFrom(userTypeClass) ) { ! return new CompositeCustomType(userTypeClass); ! } ! else { ! return new CustomType(userTypeClass); ! } } Index: UserType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/UserType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UserType.java 9 Feb 2003 06:28:14 -0000 1.5 --- UserType.java 6 Apr 2003 02:28:55 -0000 1.6 *************** *** 7,12 **** /** ! * This interface should be implemented by user-defined types. ! * The interface <ul> * <li>abstracts user code from future changes to the <tt>Type</tt> * interface,</li> --- 7,17 ---- /** ! * This interface should be implemented by user-defined "types". ! * A "type" class is <em>not</em> the actual property type - it ! * is a class that knows how to serialize instances of another ! * class to and from JDBC.<br> ! * <br> ! * This interface ! * <ul> * <li>abstracts user code from future changes to the <tt>Type</tt> * interface,</li> Index: hibernate-mapping-2.0.dtd =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-2.0.dtd,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** hibernate-mapping-2.0.dtd 5 Apr 2003 09:14:47 -0000 1.20 --- hibernate-mapping-2.0.dtd 6 Apr 2003 02:28:55 -0000 1.21 *************** *** 199,203 **** <!ATTLIST component insert (true|false) "true"> - <!ELEMENT dynabean ( (property|many-to-one|one-to-one|component|dynabean|any|map|set|list|bag|array|primitive-array)* --- 199,202 ---- *************** *** 205,208 **** --- 204,209 ---- <!ATTLIST dynabean dynaclass CDATA #REQUIRED> <!ATTLIST dynabean name CDATA #REQUIRED> + <!ATTLIST dynabean update (true|false) "true"> + <!ATTLIST dynabean insert (true|false) "true"> <!-- The parent element maps a property of the component class as a pointer back to |
From: <one...@us...> - 2003-04-06 02:29:02
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/xml In directory sc8-pr-cvs1:/tmp/cvs-serv13138/xml Modified Files: XMLDatabinder.java Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema Index: XMLDatabinder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/xml/XMLDatabinder.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XMLDatabinder.java 29 Mar 2003 04:08:50 -0000 1.7 --- XMLDatabinder.java 6 Apr 2003 02:28:59 -0000 1.8 *************** *** 176,180 **** if ( value!=null ) { String[] properties = componenttype.getPropertyNames(); ! Object[] subvalues = componenttype.getPropertyValues(value); //We know that null is okay here .. at least for ComponentType .... TODO: something safer?? Type[] subtypes = componenttype.getSubtypes(); for ( int j=0; j<properties.length; j++ ) { --- 176,180 ---- if ( value!=null ) { String[] properties = componenttype.getPropertyNames(); ! Object[] subvalues = componenttype.getPropertyValues(value, null); //We know that null is okay here .. at least for ComponentType .... TODO: something safer?? Type[] subtypes = componenttype.getSubtypes(); for ( int j=0; j<properties.length; j++ ) { |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type In directory sc8-pr-cvs1:/tmp/cvs-serv13138/type Modified Files: AbstractComponentType.java ComponentType.java CustomType.java DynaBeanType.java ObjectType.java TypeFactory.java Added Files: CompositeCustomType.java Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema --- NEW FILE: CompositeCustomType.java --- package net.sf.hibernate.type; import net.sf.hibernate.CompositeUserType; import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; import net.sf.hibernate.engine.Cascades; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.engine.Cascades.CascadeStyle; import net.sf.hibernate.loader.OuterJoinLoader; public class CompositeCustomType extends CustomType implements AbstractComponentType { public CompositeCustomType(Class userTypeClass) throws MappingException { super(userTypeClass); } public Type[] getSubtypes() { return ( (CompositeUserType) getUserType() ).getPropertyTypes(); } public String[] getPropertyNames() { return ( (CompositeUserType) getUserType() ).getPropertyNames(); } public Object[] getPropertyValues(Object component, SessionImplementor session) throws HibernateException { int len = getSubtypes().length; Object[] result = new Object[len]; for ( int i=0; i<len; i++ ) { result[i] = getPropertyValue(component, i, session); } return result; } public void setPropertyValues(Object component, Object[] values) throws HibernateException { throw new UnsupportedOperationException(); } public Object getPropertyValue(Object component, int i, SessionImplementor session) throws HibernateException { return ( (CompositeUserType) getUserType() ).getPropertyValue(component, i); } public CascadeStyle cascade(int i) { return Cascades.STYLE_NONE; } public int enableJoinedFetch(int i) { return OuterJoinLoader.LAZY; } public boolean isComponentType() { return true; } } Index: AbstractComponentType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/AbstractComponentType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractComponentType.java 29 Mar 2003 04:08:49 -0000 1.6 --- AbstractComponentType.java 6 Apr 2003 02:28:58 -0000 1.7 *************** *** 4,7 **** --- 4,8 ---- import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.Cascades; + import net.sf.hibernate.engine.SessionImplementor; /** *************** *** 11,17 **** public Type[] getSubtypes(); public String[] getPropertyNames(); ! public Object[] getPropertyValues(Object component) throws HibernateException; public void setPropertyValues(Object component, Object[] values) throws HibernateException; ! public Object getPropertyValue(Object component, int i) throws HibernateException; //public Object instantiate(Object parent, SessionImplementor session) throws HibernateException; public Cascades.CascadeStyle cascade(int i); --- 12,18 ---- public Type[] getSubtypes(); public String[] getPropertyNames(); ! public Object[] getPropertyValues(Object component, SessionImplementor session) throws HibernateException; public void setPropertyValues(Object component, Object[] values) throws HibernateException; ! public Object getPropertyValue(Object component, int i, SessionImplementor session) throws HibernateException; //public Object instantiate(Object parent, SessionImplementor session) throws HibernateException; public Cascades.CascadeStyle cascade(int i); Index: ComponentType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ComponentType.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ComponentType.java 29 Mar 2003 07:36:23 -0000 1.10 --- ComponentType.java 6 Apr 2003 02:28:58 -0000 1.11 *************** *** 181,191 **** } public Object getPropertyValue(Object component, int i) throws HibernateException { return getters[i].get(component); } public Object[] getPropertyValues(Object component) throws HibernateException { ! if(optimizer!=null) { try { return optimizer.getPropertyValues(component); --- 181,199 ---- } + public Object getPropertyValue(Object component, int i, SessionImplementor session) throws HibernateException { + return getPropertyValue(component, i); + } + public Object getPropertyValue(Object component, int i) throws HibernateException { return getters[i].get(component); } + public Object[] getPropertyValues(Object component, SessionImplementor session) throws HibernateException { + return getPropertyValues(component); + } + public Object[] getPropertyValues(Object component) throws HibernateException { ! if (optimizer!=null) { try { return optimizer.getPropertyValues(component); *************** *** 304,308 **** } ! public Object assemble(Serializable object, SessionImplementor session, Object owner) throws HibernateException, SQLException { if ( object==null ) { return null; --- 312,318 ---- } ! public Object assemble(Serializable object, SessionImplementor session, Object owner) ! throws HibernateException, SQLException { ! if ( object==null ) { return null; Index: CustomType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/CustomType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CustomType.java 3 Feb 2003 10:28:48 -0000 1.6 --- CustomType.java 6 Apr 2003 02:28:58 -0000 1.7 *************** *** 28,31 **** --- 28,35 ---- private final int[] types; + protected UserType getUserType() { + return userType; + } + public CustomType(Class userTypeClass) throws MappingException { Index: DynaBeanType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/DynaBeanType.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DynaBeanType.java 29 Mar 2003 04:08:49 -0000 1.4 --- DynaBeanType.java 6 Apr 2003 02:28:59 -0000 1.5 *************** *** 63,66 **** --- 63,76 ---- } + public Object getPropertyValue(Object component, int i, SessionImplementor session) + throws HibernateException { + return getPropertyValue(component, i); + } + + public Object[] getPropertyValues(Object component, SessionImplementor session) + throws HibernateException { + return getPropertyValues(component); + } + /** * @see net.sf.hibernate.type.AbstractComponentType#getPropertyValue(java.lang.Object, int) Index: ObjectType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ObjectType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ObjectType.java 29 Mar 2003 04:08:49 -0000 1.6 --- ObjectType.java 6 Apr 2003 02:28:59 -0000 1.7 *************** *** 10,19 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; import net.sf.hibernate.engine.Mapping; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.ArrayHelper; ! public class ObjectType extends AbstractType { private Type identifierType; --- 10,23 ---- import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; + import net.sf.hibernate.TransientObjectException; + import net.sf.hibernate.engine.Cascades; import net.sf.hibernate.engine.Mapping; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; + import net.sf.hibernate.engine.Cascades.CascadeStyle; + import net.sf.hibernate.loader.OuterJoinLoader; import net.sf.hibernate.util.ArrayHelper; ! public class ObjectType extends AbstractType implements AbstractComponentType { private Type identifierType; *************** *** 184,187 **** --- 188,244 ---- */ public boolean isObjectType() { + return true; + } + + + public CascadeStyle cascade(int i) { + return Cascades.STYLE_NONE; + } + + public int enableJoinedFetch(int i) { + return OuterJoinLoader.LAZY; + } + + private static final String[] PROPERTY_NAMES = new String[] { "class", "id" }; + + public String[] getPropertyNames() { + return PROPERTY_NAMES; + } + + public Object getPropertyValue(Object component, int i, SessionImplementor session) + throws HibernateException { + + return (i==0) ? + component.getClass() : + id(component, session); + } + + public Object[] getPropertyValues(Object component, SessionImplementor session) + throws HibernateException { + + return new Object[] { component.getClass(), id(component, session) }; + } + + private Serializable id(Object component, SessionImplementor session) throws HibernateException { + try { + return session.getEntityIdentifierIfNotUnsaved(component); + } + catch (TransientObjectException toe) { + return null; + } + } + + public Type[] getSubtypes() { + return new Type[] { Hibernate.CLASS, identifierType }; + } + + public void setPropertyValues(Object component, Object[] values) + throws HibernateException { + + throw new UnsupportedOperationException(); + + } + + public boolean isComponentType() { return true; } Index: TypeFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/TypeFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TypeFactory.java 2 Feb 2003 04:19:52 -0000 1.6 --- TypeFactory.java 6 Apr 2003 02:28:59 -0000 1.7 *************** *** 16,19 **** --- 16,20 ---- import java.util.TimeZone; + import net.sf.hibernate.CompositeUserType; import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; *************** *** 138,141 **** --- 139,145 ---- throw new MappingException("Could not instantiate Type " + typeClass.getName() + ": " + e); } + } + else if ( CompositeUserType.class.isAssignableFrom(typeClass) ) { + type = new CompositeCustomType(typeClass); } else if ( UserType.class.isAssignableFrom(typeClass) ) { |
From: <one...@us...> - 2003-04-06 02:29:01
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv13138/test Modified Files: DoubleStringType.java FooBarTest.java MultiTableTest.java Qux.hbm.xml Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema Index: DoubleStringType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/DoubleStringType.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DoubleStringType.java 5 Jan 2003 02:11:23 -0000 1.3 --- DoubleStringType.java 6 Apr 2003 02:28:58 -0000 1.4 *************** *** 7,15 **** import java.sql.Types; import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.UserType; ! public class DoubleStringType implements UserType { private static final int[] TYPES = { Types.VARCHAR, Types.VARCHAR }; --- 7,16 ---- import java.sql.Types; + import net.sf.hibernate.CompositeUserType; import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; ! import net.sf.hibernate.type.Type; ! public class DoubleStringType implements CompositeUserType { private static final int[] TYPES = { Types.VARCHAR, Types.VARCHAR }; *************** *** 58,61 **** --- 59,82 ---- } + public String[] getPropertyNames() { + return new String[] { "1", "2" }; + } + + public Type[] getPropertyTypes() { + return new Type[] { Hibernate.STRING, Hibernate.STRING }; + } + + public Object getPropertyValue(Object component, int property) { + return ( (String[]) component )[property]; + } + + public void setPropertyValue( + Object component, + int property, + Object value) { + + ( (String[]) component )[property] = (String) value; + } + } Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** FooBarTest.java 5 Apr 2003 07:13:38 -0000 1.48 --- FooBarTest.java 6 Apr 2003 02:28:58 -0000 1.49 *************** *** 2152,2155 **** --- 2152,2166 ---- s.connection().commit(); s.close(); + + s = sessions.openSession(); + foo = new Foo(); + s.save(foo); + foo.setCustom( new String[] { "one", "two" } ); + assertTrue( s.find("from Foo foo where foo.custom.1 = 'one'").get(0)==foo ); + s.delete(foo); + s.flush(); + s.connection().commit(); + s.close(); + } Index: MultiTableTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MultiTableTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MultiTableTest.java 16 Mar 2003 03:37:01 -0000 1.11 --- MultiTableTest.java 6 Apr 2003 02:28:58 -0000 1.12 *************** *** 188,194 **** s.find("from m in class Multi").size()==2 ); ! /*assertTrue( ! s.find("from m in class Multi where m.class = Multi").size()==1 ! );*/ assertTrue( s.find("from s in class Simple").size()==3 --- 188,197 ---- s.find("from m in class Multi").size()==2 ); ! assertTrue( ! s.find("from m in class Multi where m.class = SubMulti").size()==1 ! ); ! assertTrue( ! s.find("from m in class Simple where m.class = Multi").size()==2 ! ); assertTrue( s.find("from s in class Simple").size()==3 Index: Qux.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Qux.hbm.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Qux.hbm.xml 29 Mar 2003 07:36:22 -0000 1.6 --- Qux.hbm.xml 6 Apr 2003 02:28:58 -0000 1.7 *************** *** 1,5 **** <?xml version="1.0"?> <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > ! <hibernate-mapping> <class name="net.sf.hibernate.test.Qux" table="quux" proxy="net.sf.hibernate.test.Qux"> <!----> --- 1,5 ---- <?xml version="1.0"?> <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > ! <hibernate-mapping schema="dbo"> <class name="net.sf.hibernate.test.Qux" table="quux" proxy="net.sf.hibernate.test.Qux"> <!----> |
From: <one...@us...> - 2003-04-06 02:29:00
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id In directory sc8-pr-cvs1:/tmp/cvs-serv13138/id Modified Files: PersistentIdentifierGenerator.java SequenceGenerator.java TableGenerator.java Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema Index: PersistentIdentifierGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/PersistentIdentifierGenerator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PersistentIdentifierGenerator.java 5 Jan 2003 02:11:21 -0000 1.3 --- PersistentIdentifierGenerator.java 6 Apr 2003 02:28:57 -0000 1.4 *************** *** 14,17 **** --- 14,22 ---- /** + * The configuration parameter holding the schema name + */ + public static final String SCHEMA = "schema"; + + /** * The SQL required to create the underlying database objects. * @param dialect Index: SequenceGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/SequenceGenerator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SequenceGenerator.java 19 Jan 2003 11:47:07 -0000 1.5 --- SequenceGenerator.java 6 Apr 2003 02:28:57 -0000 1.6 *************** *** 17,20 **** --- 17,21 ---- import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.PropertiesHelper; + import net.sf.hibernate.util.StringHelper; import net.sf.hibernate.dialect.Dialect; *************** *** 46,49 **** --- 47,53 ---- public void configure(Type type, Properties params, Dialect dialect) throws MappingException { this.sequenceName = PropertiesHelper.getString(SEQUENCE, params, "hibernate_sequence"); + String schemaName = params.getProperty(SCHEMA); + if ( schemaName!=null && sequenceName.indexOf(StringHelper.DOT)<0 ) + sequenceName = schemaName + '.' + sequenceName; returnClass = type.getReturnedClass(); sql = dialect.getSequenceNextValString(sequenceName); Index: TableGenerator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/id/TableGenerator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TableGenerator.java 1 Mar 2003 21:27:30 -0000 1.2 --- TableGenerator.java 6 Apr 2003 02:28:57 -0000 1.3 *************** *** 18,21 **** --- 18,22 ---- import net.sf.hibernate.type.Type; import net.sf.hibernate.util.PropertiesHelper; + import net.sf.hibernate.util.StringHelper; /** *************** *** 61,64 **** --- 62,68 ---- this.tableName = PropertiesHelper.getString(TABLE, params, "hibernate_unique_key"); this.columnName = PropertiesHelper.getString(COLUMN, params, "next_hi"); + String schemaName = params.getProperty(SCHEMA); + if ( schemaName!=null && tableName.indexOf(StringHelper.DOT)<0 ) + tableName = schemaName + '.' + tableName; query = "select " + columnName + " from " + tableName; |
From: <one...@us...> - 2003-04-06 02:29:00
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv13138/impl Modified Files: SessionImpl.java Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** SessionImpl.java 3 Apr 2003 12:34:29 -0000 1.31 --- SessionImpl.java 6 Apr 2003 02:28:57 -0000 1.32 *************** *** 773,777 **** else if ( type.isComponentType() ) { AbstractComponentType actype = (AbstractComponentType) type; ! Object[] subvalues = actype.getPropertyValues(value); Type[] subtypes = actype.getSubtypes(); boolean substitute=false; --- 773,777 ---- else if ( type.isComponentType() ) { AbstractComponentType actype = (AbstractComponentType) type; ! Object[] subvalues = actype.getPropertyValues(value, this); Type[] subtypes = actype.getSubtypes(); boolean substitute=false; *************** *** 1062,1066 **** Type[] types = actype.getSubtypes(); for ( int i=0; i<types.length; i++ ) { ! removeCollectionsFor( types[i], id, actype.getPropertyValue(value, i) ); } } --- 1062,1066 ---- Type[] types = actype.getSubtypes(); for ( int i=0; i<types.length; i++ ) { ! removeCollectionsFor( types[i], id, actype.getPropertyValue(value, i, this) ); } } *************** *** 2230,2234 **** Boolean isUnsaved = (id==null) ? Boolean.TRUE : interceptor.isUnsaved(object); if ( ( isUnsaved!=null && isUnsaved.booleanValue() ) || persister.isUnsaved(id) ) { ! throw new HibernateException( "object references an unsaved transient instance - save the transient instance before flushing" ); --- 2230,2234 ---- Boolean isUnsaved = (id==null) ? Boolean.TRUE : interceptor.isUnsaved(object); if ( ( isUnsaved!=null && isUnsaved.booleanValue() ) || persister.isUnsaved(id) ) { ! throw new TransientObjectException( "object references an unsaved transient instance - save the transient instance before flushing" ); *************** *** 2336,2340 **** if ( type.isComponentType() ) { AbstractComponentType componentType = (AbstractComponentType) type; ! Object[] values = componentType.getPropertyValues(obj); if ( wrap( values, componentType.getSubtypes() ) ) componentType.setPropertyValues(obj, values); } --- 2336,2340 ---- if ( type.isComponentType() ) { AbstractComponentType componentType = (AbstractComponentType) type; ! Object[] values = componentType.getPropertyValues(obj, this); if ( wrap( values, componentType.getSubtypes() ) ) componentType.setPropertyValues(obj, values); } *************** *** 2426,2430 **** AbstractComponentType componentType = (AbstractComponentType) type; ! Object[] values = componentType.getPropertyValues(obj); Type[] types = componentType.getSubtypes(); if ( wrap( values, types ) ) componentType.setPropertyValues(obj, values); --- 2426,2430 ---- AbstractComponentType componentType = (AbstractComponentType) type; ! Object[] values = componentType.getPropertyValues(obj, this); Type[] types = componentType.getSubtypes(); if ( wrap( values, types ) ) componentType.setPropertyValues(obj, values); *************** *** 2532,2536 **** AbstractComponentType componentType = (AbstractComponentType) type; ! Object[] values = componentType.getPropertyValues(obj); Type[] types = componentType.getSubtypes(); for ( int i=0; i<values.length; i++ ) { --- 2532,2536 ---- AbstractComponentType componentType = (AbstractComponentType) type; ! Object[] values = componentType.getPropertyValues(obj, this); Type[] types = componentType.getSubtypes(); for ( int i=0; i<values.length; i++ ) { |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister In directory sc8-pr-cvs1:/tmp/cvs-serv13138/persister Modified Files: AbstractEntityPersister.java EntityPersister.java NormalizedEntityPersister.java Queryable.java Log Message: added CompositeUserType refactored handling of component path expressions PersistentIdentifierGenerators now aware of schema Index: AbstractEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/AbstractEntityPersister.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** AbstractEntityPersister.java 4 Apr 2003 13:51:59 -0000 1.17 --- AbstractEntityPersister.java 6 Apr 2003 02:28:57 -0000 1.18 *************** *** 19,23 **** import net.sf.hibernate.MappingException; import net.sf.hibernate.PropertyAccessException; - import net.sf.hibernate.QueryException; import net.sf.hibernate.StaleObjectStateException; import net.sf.hibernate.Validatable; --- 19,22 ---- *************** *** 32,36 **** import net.sf.hibernate.id.IdentityGenerator; import net.sf.hibernate.mapping.Column; - import net.sf.hibernate.mapping.Component; import net.sf.hibernate.mapping.PersistentClass; import net.sf.hibernate.mapping.Property; --- 31,34 ---- *************** *** 39,43 **** import net.sf.hibernate.metadata.ClassMetadata; import net.sf.hibernate.proxy.HibernateProxy; - import net.sf.hibernate.hql.PathExpressionParser; import net.sf.hibernate.dialect.Dialect; import net.sf.hibernate.sql.SelectFragment; --- 37,40 ---- *************** *** 92,97 **** private transient final Cascades.IdentifierValue unsavedIdentifierValue; - private transient final HashMap idTypesByPropertyPath = new HashMap(); - private transient final HashMap idColumnNamesByPropertyPath = new HashMap(); protected transient final HashMap columnNamesByPropertyPath = new HashMap(); protected transient final HashMap typesByPropertyPath = new HashMap(); --- 89,92 ---- *************** *** 143,214 **** } - public String[] toColumns(String name, String path) throws QueryException { - - final String[] cols; - - if ( path.equals(PathExpressionParser.ENTITY_CLASS) ) { - cols = new String[] { getDiscriminatorColumnName() }; - } - else { - - String idprop = getIdentifierPropertyName(); - - if ( - PathExpressionParser.ENTITY_ID.equals(path) || - ( idprop!=null && path.equals(idprop) ) - ){ - cols = getIdentifierColumnNames(); - - } - else if ( - path.startsWith(PathExpressionParser.ENTITY_ID + StringHelper.DOT) || - ( idprop!=null && path.startsWith(idprop + StringHelper.DOT) ) - ) { - - int loc = path.indexOf("."); - String componentPath = path.substring(loc+1); - - if ( getIdentifierType().isComponentType() ) { - cols = getIdentifierPropertyColumnNames(componentPath); - if (cols==null) throw new QueryException("composite id path not found (or dereferenced a <key-many-to-one>)"); - } - else { - throw new QueryException("unresolved id property: " + path); - } - } - else { - return null; - } - } - - return StringHelper.prefix(cols, name + StringHelper.DOT); - - } - public Type getPropertyType(String path) { ! ! if ( path.equals(PathExpressionParser.ENTITY_CLASS) ) { ! return getDiscriminatorType(); ! } ! else { ! ! String idprop = getIdentifierPropertyName(); ! ! if ( ! PathExpressionParser.ENTITY_ID.equals(path) || ! ( idprop!=null && path.equals(idprop) ) ! ){ ! return getIdentifierType(); ! } ! else if ( ! path.startsWith(PathExpressionParser.ENTITY_ID + StringHelper.DOT) || ! ( idprop!=null && path.startsWith(idprop + StringHelper.DOT) ) ! ) { ! return getIdentifierPropertyType( path.substring( PathExpressionParser.ENTITY_ID.length()+1 ) ); ! } ! else { ! return (Type) typesByPropertyPath.get(path); ! } ! } } --- 138,143 ---- } public Type getPropertyType(String path) { ! return (Type) typesByPropertyPath.get(path); } *************** *** 421,430 **** } - public final String[] getIdentifierPropertyColumnNames(String path) { - return (String[]) idColumnNamesByPropertyPath.get(path); - } - public final Type getIdentifierPropertyType(String path) { - return (Type) idTypesByPropertyPath.get(path); - } public final String[] getPropertyColumnNames(String path) { return (String[]) columnNamesByPropertyPath.get(path); --- 350,353 ---- *************** *** 559,589 **** i++; } - - - if ( idValue.isComposite() ) { - - iter = ( (Component) idValue ).getPropertyIterator(); - while ( iter.hasNext() ) { - - Property prop = (Property) iter.next(); - idTypesByPropertyPath.put( prop.getName(), prop.getType() ); - - String[] cols = new String[ prop.getColumnSpan() ]; - Iterator colIter= prop.getColumnIterator(); - int j=0; - while ( colIter.hasNext() ) { - Column col = (Column) colIter.next(); - cols[j++] = col.getName(); - } - idColumnNamesByPropertyPath.put( prop.getName(), cols ); - if ( model.hasEmbeddedIdentifier() ) { - columnNamesByPropertyPath.put( prop.getName(), cols ); - typesByPropertyPath.put( prop.getName(), prop.getType() ); - } - - } - } - // GENERATOR --- 482,486 ---- *************** *** 772,776 **** ( (ReflectHelper.Setter) settersByPropertyName.get(propertyName) ).set(object, value); } ! } --- 669,676 ---- ( (ReflectHelper.Setter) settersByPropertyName.get(propertyName) ).set(object, value); } ! ! protected boolean hasEmbeddedIdentifier() { ! return hasEmbeddedIdentifier; ! } } Index: EntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/EntityPersister.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** EntityPersister.java 2 Apr 2003 13:10:36 -0000 1.23 --- EntityPersister.java 6 Apr 2003 02:28:57 -0000 1.24 *************** *** 7,13 **** import net.sf.hibernate.loader.SimpleEntityLoader; import net.sf.hibernate.loader.UniqueEntityLoader; - import net.sf.hibernate.mapping.Any; import net.sf.hibernate.mapping.Column; - import net.sf.hibernate.mapping.Component; import net.sf.hibernate.mapping.PersistentClass; import net.sf.hibernate.mapping.Property; --- 7,11 ---- *************** *** 30,34 **** import org.apache.commons.logging.LogFactory; - import net.sf.hibernate.Hibernate; import net.sf.hibernate.HibernateException; import net.sf.hibernate.LockMode; --- 28,31 ---- *************** *** 48,51 **** --- 45,49 ---- import net.sf.hibernate.type.EntityType; import net.sf.hibernate.type.Type; + import net.sf.hibernate.engine.Mapping; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; *************** *** 99,102 **** --- 97,103 ---- public void postInstantiate(SessionFactoryImplementor factory) throws MappingException { + initPropertyPaths(factory); + + //TODO: move into initPropertyPaths HashMap mods = new HashMap(); Iterator iter = typesByPropertyPath.entrySet().iterator(); *************** *** 687,697 **** propertyColumnAliases[i] = colAliases; ! initPropertyPaths(prop, StringHelper.EMPTY_STRING); i++; } ! if ( model.hasIdentifierProperty() && model.getIdentifierProperty().isComposite() ) { ! initPropertyPaths( model.getIdentifierProperty(), StringHelper.EMPTY_STRING ); ! } hasUpdateableColumns = foundColumn; --- 688,698 ---- propertyColumnAliases[i] = colAliases; ! //initPropertyPaths(prop, StringHelper.EMPTY_STRING, factory); i++; } ! /*if ( model.hasIdentifierProperty() && model.getIdentifierProperty().isComposite() ) { ! initPropertyPaths( model.getIdentifierProperty(), StringHelper.EMPTY_STRING, factory ); ! }*/ hasUpdateableColumns = foundColumn; *************** *** 790,835 **** } ! ! private void initPropertyPaths(Property prop, String path) { ! ! path += prop.getName(); ! if ( prop.isComposite() ) { ! Iterator iter = ( (Component) prop.getValue() ).getPropertyIterator(); ! while ( iter.hasNext() ) { ! initPropertyPaths( (Property) iter.next(), path + "." ) ; ! } ! } ! Iterator iter = prop.getColumnIterator(); ! String[] names = new String[ prop.getColumnSpan() ]; ! int k=0; ! while ( iter.hasNext() ) { ! names[k] = ( (Column) iter.next() ).getName(); ! k++; } ! Type type = prop.getType(); ! typesByPropertyPath.put(path, type); ! columnNamesByPropertyPath.put(path, names); ! if ( prop.getValue().isAny() ) { ! String idpath = path + ".id"; ! String clpath = path + ".class"; ! ! Any any = (Any) prop.getValue(); ! typesByPropertyPath.put( idpath, any.getIdentifierType() ); ! typesByPropertyPath.put( clpath, Hibernate.CLASS ); ! ! iter = any.getColumnIterator(); ! columnNamesByPropertyPath.put( clpath, new String[] { ( (Column) iter.next() ).getName() } ); ! names = new String[ any.getColumnSpan() - 1 ]; ! k=0; ! while ( iter.hasNext() ) { ! names[k++] = ( (Column) iter.next() ).getName(); } - columnNamesByPropertyPath.put(idpath, names); } - } --- 791,835 ---- } ! private void initPropertyPaths(Mapping mapping) throws MappingException { ! Type[] propertyTypes = getPropertyTypes(); ! String[] propertyNames = getPropertyNames(); ! for ( int i=0; i<propertyNames.length; i++ ) { ! initPropertyPaths( propertyNames[i], propertyTypes[i], propertyColumnNames[i], mapping ); } ! String idProp = getIdentifierPropertyName(); ! if (idProp!=null) initPropertyPaths( idProp, getIdentifierType(), getIdentifierColumnNames(), mapping ); ! if ( hasEmbeddedIdentifier() ) initPropertyPaths( null, getIdentifierType(), getIdentifierColumnNames(), mapping ); ! initPropertyPaths( PathExpressionParser.ENTITY_ID, getIdentifierType(), getIdentifierColumnNames(), mapping ); ! if ( isPolymorphic() ) { ! typesByPropertyPath.put( PathExpressionParser.ENTITY_CLASS, getDiscriminatorType() ); ! columnNamesByPropertyPath.put( PathExpressionParser.ENTITY_CLASS, new String[] { getDiscriminatorColumnName() } ); ! } ! } ! ! private void initPropertyPaths(String propertyName, Type propertyType, String[] columns, Mapping mapping) throws MappingException { ! if (propertyName!=null) { ! typesByPropertyPath.put(propertyName, propertyType); ! columnNamesByPropertyPath.put(propertyName, columns); ! } ! ! if ( propertyType.isComponentType() ) { ! AbstractComponentType compType = (AbstractComponentType) propertyType; ! String[] props = compType.getPropertyNames(); ! Type[] types = compType.getSubtypes(); ! int count=0; ! for ( int k=0; k<props.length; k++ ) { ! int len = types[k].getColumnSpan(mapping); ! String[] slice = new String[len]; ! for ( int j=0; j<len; j++ ) { ! slice[j] = columns[count++]; ! } ! String path = (propertyName==null) ? props[k] : propertyName + '.' + props[k]; ! initPropertyPaths(path, types[k], slice, mapping); } } } *************** *** 862,868 **** public String[] toColumns(String name, String property) throws QueryException { - - String[] idcols = super.toColumns(name, property); - if (idcols!=null) return idcols; String[] cols = getPropertyColumnNames(property); --- 862,865 ---- Index: NormalizedEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/NormalizedEntityPersister.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** NormalizedEntityPersister.java 29 Mar 2003 04:08:48 -0000 1.15 --- NormalizedEntityPersister.java 6 Apr 2003 02:28:57 -0000 1.16 *************** *** 7,13 **** import net.sf.hibernate.loader.EntityLoader; import net.sf.hibernate.loader.UniqueEntityLoader; - import net.sf.hibernate.mapping.Any; import net.sf.hibernate.mapping.Column; - import net.sf.hibernate.mapping.Component; import net.sf.hibernate.mapping.PersistentClass; import net.sf.hibernate.mapping.Property; --- 7,11 ---- *************** *** 49,52 **** --- 47,51 ---- import net.sf.hibernate.type.EntityType; import net.sf.hibernate.type.Type; + import net.sf.hibernate.engine.Mapping; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; *************** *** 112,115 **** --- 111,117 ---- public void postInstantiate(SessionFactoryImplementor factory) throws MappingException { + initPropertyPaths(factory); + + //TODO: move into initPropertyPaths HashMap mods = new HashMap(); Iterator iter = typesByPropertyPath.entrySet().iterator(); *************** *** 765,776 **** propertyColumnNameAliases[i] = propAliases; - initPropertyPaths(prop, StringHelper.EMPTY_STRING); i++; } - if ( model.hasIdentifierProperty() && model.getIdentifierProperty().isComposite() ) { - initPropertyPaths( model.getIdentifierProperty(), StringHelper.EMPTY_STRING ); - } - ArrayList columns = new ArrayList(); ArrayList types = new ArrayList(); --- 767,773 ---- *************** *** 889,944 **** } ! ! ! private void initPropertyPaths(Property prop, String path) { ! ! path += prop.getName(); ! if ( prop.isComposite() ) { ! Iterator iter = ( (Component) prop.getValue() ).getPropertyIterator(); ! while ( iter.hasNext() ) { ! initPropertyPaths( (Property) iter.next(), path + "." ) ; ! } ! } ! Iterator iter = prop.getColumnIterator(); ! String[] names = new String[ prop.getColumnSpan() ]; ! int k=0; ! while ( iter.hasNext() ) { ! names[k++] = ( (Column) iter.next() ).getName(); } ! Integer tabno = new Integer( getTableId( ! prop.getValue().getTable().getQualifiedName( factory.getDefaultSchema() ), ! subclassTableNameClosure ! ) ); ! Type type = prop.getType(); ! ! typesByPropertyPath.put(path, type); ! tableNumberByPropertyPath.put(path, tabno); ! columnNamesByPropertyPath.put(path, names); ! if ( prop.getValue().isAny() ) { ! String idpath = path + ".id"; ! String clpath = path + ".class"; ! ! Any any = (Any) prop.getValue(); ! typesByPropertyPath.put( idpath, any.getIdentifierType() ); ! typesByPropertyPath.put( clpath, Hibernate.CLASS ); ! ! iter = any.getColumnIterator(); ! columnNamesByPropertyPath.put( clpath, new String[] { ( (Column) iter.next() ).getName() } ); ! names = new String[ any.getColumnSpan() - 1 ]; ! k=0; ! while ( iter.hasNext() ) { ! names[k++] = ( (Column) iter.next() ).getName(); } - columnNamesByPropertyPath.put(idpath, names); - tableNumberByPropertyPath.put(idpath, tabno); - tableNumberByPropertyPath.put(clpath, tabno); } - } public String fromTableFragment(String alias) { return subclassTableNameClosure[0] + ' ' + alias; --- 886,934 ---- } ! ! private void initPropertyPaths(Mapping mapping) throws MappingException { ! Type[] propertyTypes = getPropertyTypes(); ! String[] propertyNames = getPropertyNames(); ! for ( int i=0; i<propertyNames.length; i++ ) { ! initPropertyPaths( propertyNames[i], propertyTypes[i], propertyColumnNames[i], propertyTables[i], mapping ); } ! String idProp = getIdentifierPropertyName(); ! if (idProp!=null) initPropertyPaths( idProp, getIdentifierType(), getIdentifierColumnNames(), 0, mapping ); ! if ( hasEmbeddedIdentifier() ) initPropertyPaths( null, getIdentifierType(), getIdentifierColumnNames(), 0, mapping ); ! initPropertyPaths( PathExpressionParser.ENTITY_ID, getIdentifierType(), getIdentifierColumnNames(), 0, mapping ); ! typesByPropertyPath.put( PathExpressionParser.ENTITY_CLASS, getDiscriminatorType() ); ! columnNamesByPropertyPath.put( PathExpressionParser.ENTITY_CLASS, new String[] { getDiscriminatorColumnName() } ); ! tableNumberByPropertyPath.put( PathExpressionParser.ENTITY_CLASS, new Integer(0) ); ! } ! ! private void initPropertyPaths(String propertyName, Type propertyType, String[] columns, int table, Mapping mapping) throws MappingException { ! if (propertyName!=null) { ! typesByPropertyPath.put(propertyName, propertyType); ! columnNamesByPropertyPath.put(propertyName, columns); ! tableNumberByPropertyPath.put( propertyName, new Integer(table) ); ! } ! ! if ( propertyType.isComponentType() ) { ! AbstractComponentType compType = (AbstractComponentType) propertyType; ! String[] props = compType.getPropertyNames(); ! Type[] types = compType.getSubtypes(); ! int count=0; ! for ( int k=0; k<props.length; k++ ) { ! int len = types[k].getColumnSpan(mapping); ! String[] slice = new String[len]; ! for ( int j=0; j<len; j++ ) { ! slice[j] = columns[count++]; ! } ! String path = (propertyName==null) ? props[k] : propertyName + '.' + props[k]; ! initPropertyPaths(path, types[k], slice, table, mapping); } } } + public String fromTableFragment(String alias) { return subclassTableNameClosure[0] + ' ' + alias; *************** *** 968,976 **** } - public String[] toColumns(String alias, String property) throws QueryException { - - String[] idcols = super.toColumns(alias, property); - if (idcols!=null) return idcols; String[] cols = getPropertyColumnNames(property); --- 958,962 ---- Index: Queryable.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/Queryable.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Queryable.java 2 Mar 2003 06:58:53 -0000 1.6 --- Queryable.java 6 Apr 2003 02:28:58 -0000 1.7 *************** *** 35,43 **** */ public Type getPropertyType(String path); - /** - * Given a component path expression, get the type of the composite - * identifier property - */ - public Type getIdentifierPropertyType(String path); /** --- 35,38 ---- |
From: <max...@us...> - 2003-04-05 16:18:05
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2java In directory sc8-pr-cvs1:/tmp/cvs-serv14684/src/net/sf/hibernate/tool/hbm2java Modified Files: BasicRenderer.java Generator.java Renderer.java Added Files: FinderRenderer.java Log Message: * Small refactoring of Renderer. Provide info about actual generated class and packagename * Added Matt Halls Finder generation code with adjustments. --- NEW FILE: FinderRenderer.java --- package net.sf.hibernate.tool.hbm2java; import java.io.PrintWriter; import java.io.StringWriter; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * <p>Title: Basic Finder Generator for Hibernate 2</p> * <p>Description: Generate basic finders for hibernate properties. * This requires two things in the hbm.xml files. * * The first is an indication of which fields you want to generate finders for. * You indicate that with a meta block inside a property tag such as * * <property name="name" column="name" type="string"> * <meta attribute="finder-method">findByName</meta> * </property> * * The finder method name will be the text enclosed in the meta tags. * * The second is to create a config file for hbm2java of the format: * * <codegen> * <generate renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer"/> * <generate suffix="Finder" renderer="net.sf.hibernate.tool.hbm2java.FinderRenderer"/> * </codegen> * * And then use the param to hbm2java --config=xxx.xml where xxx.xml is the config file you * just created. * * An optional parameter is meta tag at the class level of the format: * * <meta attribute="sessionMethod">com.whatever.SessionTable.getSessionTable().getSession();</meta> * * Which would be the way in which you get sessions if you use the Thread Local Session pattern * like I do. * </p> * <p>Copyright: Copyright (c) 2003</p> * @author Matt Hall (matt2k(at)users.sf.net) * @author Max Rydahl Andersen (small adjustments and bugfixes) * @version 1.0 */ public class FinderRenderer extends AbstractRenderer { private static final String MT_FINDERMETHOD = "finder"; private static Log log = LogFactory.getLog(FinderRenderer.class); /** * Render finder classes. *@param classMapping *@param class2classmap *@param mainwriter *@exception Exception */ public void render(String savedToPackage, String savedToClass, ClassMapping classMapping, Map class2classmap, PrintWriter mainwriter) throws Exception { if (savedToPackage!=null && !savedToPackage.trim().equals("")) { mainwriter.println("package " + savedToPackage +";"); } else if (classMapping.getGeneratedPackageName() != null) { mainwriter.println("package " + classMapping.getGeneratedPackageName() + ";"); } else { mainwriter.println("// default package"); } mainwriter.println(); // switch to another writer to be able to insert the actually // used imports when whole class has been rendered. StringWriter strWriter = new StringWriter(); PrintWriter writer = new PrintWriter(strWriter); writer.println("/** Automatically generated Finder class for " + savedToClass + ".\n" + " * @author Hibernate FinderGenerator " + " **/"); String classScope = "public"; writer.print(classScope + " class " + savedToClass); // always implements Serializable writer.print(" implements Serializable"); writer.println(" {"); writer.println(); // switch to another writer to be able to insert the // veto- and changeSupport fields StringWriter strPropWriter = new StringWriter(); PrintWriter propWriter = new PrintWriter(strPropWriter); doFinders(classMapping, class2classmap, propWriter); propWriter.println("}"); writer.print(strPropWriter.toString()); // finally write the imports doImports(classMapping, mainwriter); mainwriter.print(strWriter.toString()); } /** * Create finders for properties that have the <meta atttribute="finder-method"> * finderName</meta> block defined. Also, create a findAll(Session) method. * *@param classMapping *@param class2classmap *@param writer */ public void doFinders(ClassMapping classMapping, Map class2classmap, PrintWriter writer) { // Find out of there is a system wide way to get sessions defined String sessionMethod = classMapping.getMetaAsString("sessionMethod").trim(); // fields for (Iterator fields = classMapping.getFields().iterator(); fields.hasNext(); ) { Field field = (Field) fields.next(); if (field.getMeta(MT_FINDERMETHOD) != null) { String finderName = field.getMetaAsString(MT_FINDERMETHOD); if ("".equals(sessionMethod)) { // Make the method signature require a session to be passed in writer.println(" public static List " + finderName + "(Session session, " + getTrueTypeName(field, class2classmap) + " " + field.getName() + ") " + "throws SQLException, HibernateException {"); } else { // Use the session method to get the session to execute the query writer.println(" public static List " + finderName + "(" + getTrueTypeName(field, class2classmap) + " " + field.getName() + ") " + "throws SQLException, HibernateException {"); writer.println(" Session session = " + sessionMethod); } writer.println(" List finds = session.find(\"from " + classMapping.getName() + " in class " + classMapping.getPackageName() + "." + classMapping.getName() + " where " + classMapping.getName() + "." + field.getName() + "=?\", " + getFieldAsObject(false, field) + ", " + getFieldAsHibernateType(false, field) + ");"); writer.println(" return finds;"); writer.println(" }"); } writer.println(); } // Create the findAll() method if ("".equals(sessionMethod)) { writer.println(" public static List findAll" + "(Session session) " + "throws SQLException, HibernateException {"); } else { writer.println(" public static List findAll() " + "throws SQLException, HibernateException {"); writer.println(" Session session = " + sessionMethod); } writer.println(" List finds = session.find(\"from " + classMapping.getName() + " in class " + classMapping.getPackageName() + "." + classMapping.getName() + "\");"); writer.println(" return finds;"); writer.println(" }"); writer.println(); } static Map primitiveToObject = new HashMap(); { primitiveToObject.put("char", "Character"); primitiveToObject.put("byte", "Byte"); primitiveToObject.put("short", "Short"); primitiveToObject.put("int", "Integer"); primitiveToObject.put("long", "Long"); primitiveToObject.put("boolean", "Boolean"); primitiveToObject.put("float", "Float"); primitiveToObject.put("double", "Double"); } /** * Generate the imports for the finder class. * *@param classMapping *@param writer */ public void doImports(ClassMapping classMapping, PrintWriter writer) { // imports is not included from the class it self as this is a separate generated class. /* classMapping.getImports().add("java.io.Serializable"); for (Iterator imports = classMapping.getImports().iterator(); imports.hasNext(); ) { writer.println("import " + imports.next() + ";"); } */ // Imports for finders writer.println("import java.io.Serializable;"); writer.println("import java.util.List;"); writer.println("import java.sql.SQLException;"); writer.println(); // * import is bad style. But better than importing classing that we don't necesarrily uses... writer.println("import net.sf.hibernate.*;"); // writer.println("import net.sf.hibernate.Hibernate;"); // writer.println("import net.sf.hibernate.HibernateException;"); writer.println(); } /** * Gets the fieldAsObject attribute of the FinderRenderer object * *@param prependThis *@param field *@return */ private String getFieldAsObject(boolean prependThis, Field field) { ClassName type = field.getClassType(); if (type != null && type.isPrimitive() && !type.isArray()) { String typeName = (String) primitiveToObject.get(type.getName()); typeName = "new " + typeName + "( "; typeName += prependThis ? "this." : ""; return typeName + field.getName() + " )"; } return field.getName(); } /** * Coversion map for field types to Hibernate types, might be good to move * this to some other more general class */ static Map hibType = new HashMap(); { hibType.put("char", "Hibernate.CHARACTER"); hibType.put("byte", "Hibernate.BYTE"); hibType.put("short", "Hibernate.SHORT"); hibType.put("int", "Hibernate.INTEGER"); hibType.put("long", "Hibernate.LONG"); hibType.put("boolean", "Hibernate.BOOLEAN"); hibType.put("float", "Hibernate.FLOAT"); hibType.put("double", "Hibernate.DOUBLE"); hibType.put("String", "Hibernate.STRING"); } /** * Return the hibernate type string for the given field * *@param prependThis *@param field *@return */ private String getFieldAsHibernateType(boolean prependThis, Field field) { ClassName type = field.getClassType(); String hibTypeString = (String) hibType.get(type.getName()); if (hibType != null) { return hibTypeString; } else { return "Hibernate.OBJECT"; } } } Index: BasicRenderer.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2java/BasicRenderer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** BasicRenderer.java 29 Mar 2003 04:08:49 -0000 1.13 --- BasicRenderer.java 5 Apr 2003 16:18:01 -0000 1.14 *************** *** 23,28 **** static private Log log = LogFactory.getLog(BasicRenderer.class); ! public void render(ClassMapping classMapping, Map class2classmap, PrintWriter mainwriter) throws Exception { ! if ( classMapping.getGeneratedPackageName()!=null ) { mainwriter.println("package " + classMapping.getGeneratedPackageName() + ";"); } --- 23,30 ---- static private Log log = LogFactory.getLog(BasicRenderer.class); ! public void render(String savedToPackage, String savedToClass, ClassMapping classMapping, Map class2classmap, PrintWriter mainwriter) throws Exception { ! if (savedToPackage!=null && !savedToPackage.trim().equals("")) { ! mainwriter.println("package " + savedToPackage + ";"); ! } else if ( classMapping.getGeneratedPackageName()!=null ) { mainwriter.println("package " + classMapping.getGeneratedPackageName() + ";"); } *************** *** 50,56 **** } if(classMapping.shouldBeAbstract()) { ! writer.print( "abstract " + classScope + " class " + classMapping.getGeneratedName() ); } else { ! writer.print( classScope + " class " + classMapping.getGeneratedName() ); } --- 52,58 ---- } if(classMapping.shouldBeAbstract()) { ! writer.print( "abstract " + classScope + " class " + savedToClass ); } else { ! writer.print( classScope + " class " + savedToClass ); } *************** *** 93,97 **** doFields(classMapping, propWriter); ! doConstructors(classMapping, class2classmap, propWriter); String vetoSupport = makeSupportField("vetos", classMapping.getAllFields()); --- 95,99 ---- doFields(classMapping, propWriter); ! doConstructors(savedToClass, classMapping, class2classmap, propWriter); String vetoSupport = makeSupportField("vetos", classMapping.getAllFields()); *************** *** 102,106 **** doToString(classMapping, propWriter); ! doEqualsAndHashCode(classMapping, propWriter); propWriter.println("}"); --- 104,108 ---- doToString(classMapping, propWriter); ! doEqualsAndHashCode(savedToClass,classMapping, propWriter); propWriter.println("}"); *************** *** 179,188 **** ! public void doConstructors(ClassMapping classMapping, Map class2classmap, PrintWriter writer) { // full constructor List allFieldsForFullConstructor = classMapping.getAllFieldsForFullConstructor(); writer.println(" /** full constructor */"); ! String fullCons = " public " + classMapping.getGeneratedName() + StringHelper.OPEN_PAREN; --- 181,190 ---- ! public void doConstructors(String savedToClass, ClassMapping classMapping, Map class2classmap, PrintWriter writer) { // full constructor List allFieldsForFullConstructor = classMapping.getAllFieldsForFullConstructor(); writer.println(" /** full constructor */"); ! String fullCons = " public " + savedToClass + StringHelper.OPEN_PAREN; *************** *** 223,227 **** if (allFieldsForFullConstructor.size() > 0) { writer.println(" /** default constructor */"); ! writer.println(" public " + classMapping.getGeneratedName() + "() {"); writer.println(" }"); writer.println(); --- 225,229 ---- if (allFieldsForFullConstructor.size() > 0) { writer.println(" /** default constructor */"); ! writer.println(" public " + savedToClass + "() {"); writer.println(" }"); writer.println(); *************** *** 234,238 **** writer.println(" /** minimal constructor */"); ! String minCons = " public " + classMapping.getGeneratedName() + StringHelper.OPEN_PAREN; for (Iterator fields = allFieldsForMinimalConstructor.iterator(); fields.hasNext();) { Field field = (Field) fields.next(); --- 236,240 ---- writer.println(" /** minimal constructor */"); ! String minCons = " public " + savedToClass + "("; for (Iterator fields = allFieldsForMinimalConstructor.iterator(); fields.hasNext();) { Field field = (Field) fields.next(); *************** *** 294,302 **** } ! public void doEqualsAndHashCode(ClassMapping classMapping, PrintWriter writer) { if ( classMapping.mustImplementEquals() ) { writer.println(" public boolean equals(Object other) {"); ! writer.println(" if ( !(other instanceof " + classMapping.getGeneratedName() + ") ) return false;"); ! writer.println(" " + classMapping.getGeneratedName() + " castOther = (" + classMapping.getGeneratedName() + ") other;"); writer.println(" return new EqualsBuilder()"); for (Iterator fields = classMapping.getFields().iterator(); fields.hasNext();) { --- 296,304 ---- } ! public void doEqualsAndHashCode(String savedToClass, ClassMapping classMapping, PrintWriter writer) { if ( classMapping.mustImplementEquals() ) { writer.println(" public boolean equals(Object other) {"); ! writer.println(" if ( !(other instanceof " + savedToClass + ") ) return false;"); ! writer.println(" " + savedToClass + " castOther = (" + savedToClass + ") other;"); writer.println(" return new EqualsBuilder()"); for (Iterator fields = classMapping.getFields().iterator(); fields.hasNext();) { Index: Generator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2java/Generator.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Generator.java 25 Mar 2003 08:08:02 -0000 1.8 --- Generator.java 5 Apr 2003 16:18:02 -0000 1.9 *************** *** 66,78 **** // set lowerFirstLetter value = generateElement.getAttributeValue("lowerFirstLetter"); ! if ( (value == null) || ( value.equals("false") ) ) { ! this.lowerFirstLetter = false; ! } ! else if ( value.equals("true") ) { ! this.lowerFirstLetter = true; ! } ! else { ! throw new Exception("invalid value for element lowerFirstLeter. should be true or false."); ! } } --- 66,70 ---- // set lowerFirstLetter value = generateElement.getAttributeValue("lowerFirstLetter"); ! this.lowerFirstLetter = Boolean.valueOf(value).booleanValue(); } *************** *** 115,123 **** File dir = this.getDir(classMapping.getGeneratedPackageName()); File file = new File(dir, this.getFileName(classMapping.getGeneratedName())); ! log.debug("Writing " + file); PrintWriter writer = new PrintWriter(new FileOutputStream(file)); ! renderer.render(classMapping, class2classmap, writer); writer.close(); } --- 107,115 ---- File dir = this.getDir(classMapping.getGeneratedPackageName()); File file = new File(dir, this.getFileName(classMapping.getGeneratedName())); ! log.info("Writing " + file); PrintWriter writer = new PrintWriter(new FileOutputStream(file)); ! renderer.render(this.packageName, getName(classMapping.getGeneratedName()), classMapping, class2classmap, writer); writer.close(); } Index: Renderer.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2java/Renderer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Renderer.java 25 Mar 2003 08:08:04 -0000 1.4 --- Renderer.java 5 Apr 2003 16:18:02 -0000 1.5 *************** *** 8,12 **** public interface Renderer { ! public void render(ClassMapping classMapping, Map class2classmap, PrintWriter writer) throws Exception; } --- 8,12 ---- public interface Renderer { ! public void render(String savedToPackage, String savedToClass, ClassMapping classMapping, Map class2classmap, PrintWriter writer) throws Exception; } |
From: <one...@us...> - 2003-04-05 09:14:50
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv25027 Modified Files: hibernate-configuration-2.0.dtd hibernate-mapping-2.0.dtd Log Message: adjust dtd to support nonstrict cache Index: hibernate-configuration-2.0.dtd =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-configuration-2.0.dtd,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** hibernate-configuration-2.0.dtd 17 Mar 2003 07:24:19 -0000 1.5 --- hibernate-configuration-2.0.dtd 5 Apr 2003 09:14:47 -0000 1.6 *************** *** 24,33 **** <!ATTLIST jcs-class-cache class CDATA #REQUIRED> <!ATTLIST jcs-class-cache region CDATA #IMPLIED> ! <!ATTLIST jcs-class-cache usage CDATA #REQUIRED> <!ELEMENT jcs-collection-cache EMPTY> <!ATTLIST jcs-collection-cache collection CDATA #REQUIRED> <!ATTLIST jcs-collection-cache region CDATA #IMPLIED> ! <!ATTLIST jcs-collection-cache usage CDATA #REQUIRED> <!ELEMENT session-factory (property*, mapping+, (jcs-class-cache|jcs-collection-cache)*)> --- 24,33 ---- <!ATTLIST jcs-class-cache class CDATA #REQUIRED> <!ATTLIST jcs-class-cache region CDATA #IMPLIED> ! <!ATTLIST jcs-class-cache usage (read-only|read-write|nonstrict-read-write) #REQUIRED> <!ELEMENT jcs-collection-cache EMPTY> <!ATTLIST jcs-collection-cache collection CDATA #REQUIRED> <!ATTLIST jcs-collection-cache region CDATA #IMPLIED> ! <!ATTLIST jcs-collection-cache usage (read-only|read-write|nonstrict-read-write) #REQUIRED> <!ELEMENT session-factory (property*, mapping+, (jcs-class-cache|jcs-collection-cache)*)> Index: hibernate-mapping-2.0.dtd =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-2.0.dtd,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** hibernate-mapping-2.0.dtd 5 Apr 2003 07:13:37 -0000 1.19 --- hibernate-mapping-2.0.dtd 5 Apr 2003 09:14:47 -0000 1.20 *************** *** 402,406 **** <!-- The jcs-cache element enables caching of an entity class. --> <!ELEMENT jcs-cache EMPTY> ! <!ATTLIST jcs-cache usage (read-only|read-write) #REQUIRED> <!-- The query element declares a named Hibernate query string --> --- 402,406 ---- <!-- The jcs-cache element enables caching of an entity class. --> <!ELEMENT jcs-cache EMPTY> ! <!ATTLIST jcs-cache usage (read-only|read-write|nonstrict-read-write) #REQUIRED> <!-- The query element declares a named Hibernate query string --> |
From: <one...@us...> - 2003-04-05 07:48:48
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy In directory sc8-pr-cvs1:/tmp/cvs-serv4078/proxy Modified Files: CGLIBLazyInitializer.java LazyInitializer.java Log Message: use CGLIB MethodProxy Index: CGLIBLazyInitializer.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy/CGLIBLazyInitializer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CGLIBLazyInitializer.java 15 Feb 2003 08:00:51 -0000 1.4 --- CGLIBLazyInitializer.java 5 Apr 2003 07:48:45 -0000 1.5 *************** *** 42,47 **** } ! public Object intercept(Object obj, Method method, Object args[], MethodProxy proxy) throws Throwable{ ! return invoke(method, args); } --- 42,53 ---- } ! public Object intercept(Object obj, Method method, Object args[], MethodProxy proxy) throws Throwable { ! Object result = invoke(method, args); ! if (result==INVOKE_IMPLEMENTATION) { ! return proxy.invoke( getImplementation(), args ); ! } ! else { ! return result; ! } } Index: LazyInitializer.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy/LazyInitializer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LazyInitializer.java 29 Mar 2003 04:08:48 -0000 1.6 --- LazyInitializer.java 5 Apr 2003 07:48:45 -0000 1.7 *************** *** 3,7 **** import java.io.Serializable; - import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; --- 3,6 ---- *************** *** 19,22 **** --- 18,23 ---- public abstract class LazyInitializer { + protected static final Object INVOKE_IMPLEMENTATION = new Object(); + protected Object target = null; protected Serializable id; *************** *** 105,114 **** // otherwise: ! try { return method.invoke( getImplementation(), args ); } catch (InvocationTargetException ite) { throw ite.getTargetException(); ! } } --- 106,117 ---- // otherwise: ! return INVOKE_IMPLEMENTATION; ! ! /*try { return method.invoke( getImplementation(), args ); } catch (InvocationTargetException ite) { throw ite.getTargetException(); ! }*/ } |
From: <one...@us...> - 2003-04-05 07:13:41
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv26924/test Modified Files: Baz.hbm.xml Baz.java Fee.hbm.xml FooBarTest.java SQLFunctionsTest.java Log Message: added many-to-any, index-many-to-any added update and insert attributes to component Index: Baz.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Baz.hbm.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Baz.hbm.xml 4 Apr 2003 13:51:59 -0000 1.16 --- Baz.hbm.xml 5 Apr 2003 07:13:38 -0000 1.17 *************** *** 87,188 **** </map> ! <set name="stringSet" lazy="true" sort="natural"> ! <!--<jcs-cache usage="read-write"/>--> ! <key column="id_" /> ! <element column="element" type="string" not-null="true" length="32"/> ! </set> ! ! <map name="stringDateMap" lazy="true" sort="net.sf.hibernate.test.ReverseComparator"> ! <key column="id_" /> ! <index column="map_key" type="string" length="32"/> ! <element column="map_value" type="date"/> ! </map> ! ! <array name="fooArray" element-class="net.sf.hibernate.test.FooProxy" where="i<8"> ! <jcs-cache usage="read-write"/> ! <key column="id_" /> ! <index column="i"/> ! <many-to-many class="net.sf.hibernate.test.Foo"> ! <column name="foo" length="36"/> ! </many-to-many> ! </array> ! ! <bag name="fooBag" lazy="true" table="baz_foo" cascade="all"> ! <key column="baz" /> ! <many-to-many class="net.sf.hibernate.test.Foo" column="foo" outer-join="true"/> ! </bag> ! ! <array name="stringArray"> ! <key column="id_" /> ! <index column="i"/> ! <element column="name" type="string"/> ! </array> ! <list name="fees" lazy="true" cascade="all"> ! <key column="bazid"/> ! <index column="bazind"/> ! <one-to-many class="net.sf.hibernate.test.Fee"/> ! </list> ! <list name="customs"> ! <key column="id_"/> ! <index column="indx"/> ! <element type="net.sf.hibernate.test.DoubleStringType"> ! <column name="first_"/> ! <column name="second_"/> ! </element> ! </list> ! ! <list name="topComponents" table="topcomponents"> ! <jcs-cache usage="read-write"/> ! <key column="id_"/> ! <index column="i"/> ! <composite-element class="net.sf.hibernate.test.FooComponent"> ! <property name="name"/> ! <property name="count" column="count_"/> ! </composite-element> ! </list> ! <set name="topFoos"> ! <key column="idtopbar" /> ! <one-to-many class = "net.sf.hibernate.test.Bar"/> ! </set> ! ! <set name="cascadingBars" cascade="all"> ! <key column="idtopbar" /> ! <one-to-many class = "net.sf.hibernate.test.Bar"/> ! </set> ! ! <map name="topGlarchez"> ! <key column="idtopglarch" /> ! <index column="mapkey" type="character"/> ! <one-to-many class = "net.sf.hibernate.test.Glarch"/> ! </map> ! <set name="cached" sort="natural" table="cached_set"> ! <jcs-cache usage="read-write"/> ! <key column="baz"/> ! <composite-element class="net.sf.hibernate.test.CompositeElement"> ! <property name="foo"/> ! <property name="bar"/> ! </composite-element> ! </set> ! ! <map name="cachedMap" sort="natural" table="cached_map"> ! <jcs-cache usage="read-write"/> ! <key column="baz"/> ! <index-many-to-many column="another_baz" class="net.sf.hibernate.test.Baz"/> ! <composite-element class="net.sf.hibernate.test.CompositeElement"> ! <property name="foo"/> ! <property name="bar"/> ! </composite-element> ! </map> ! <map name="stringGlarchMap" where="baz_map_index > 'a' and tha_key is not null" cascade="all"> ! <key column="baz_map_id"/> ! <index column="baz_map_index" type="string"/> ! <one-to-many class="net.sf.hibernate.test.Glarch"/> ! </map> ! </class> --- 87,200 ---- </map> ! <set name="stringSet" lazy="true" sort="natural"> ! <!--<jcs-cache usage="read-write"/>--> ! <key column="id_" /> ! <element column="element" type="string" not-null="true" length="32"/> ! </set> ! <map name="stringDateMap" lazy="true" sort="net.sf.hibernate.test.ReverseComparator"> ! <key column="id_" /> ! <index column="map_key" type="string" length="32"/> ! <element column="map_value" type="date"/> ! </map> ! <array name="fooArray" element-class="net.sf.hibernate.test.FooProxy" where="i<8"> ! <jcs-cache usage="read-write"/> ! <key column="id_" /> ! <index column="i"/> ! <many-to-many class="net.sf.hibernate.test.Foo"> ! <column name="foo" length="36"/> ! </many-to-many> ! </array> ! <bag name="fooBag" lazy="true" table="baz_foo" cascade="all"> ! <key column="baz" /> ! <many-to-many class="net.sf.hibernate.test.Foo" column="foo" outer-join="true"/> ! </bag> ! <array name="stringArray"> ! <key column="id_" /> ! <index column="i"/> ! <element column="name" type="string"/> ! </array> ! ! <list name="fees" lazy="true" cascade="all"> ! <key column="bazid"/> ! <index column="bazind"/> ! <one-to-many class="net.sf.hibernate.test.Fee"/> ! </list> ! ! <list name="customs"> ! <key column="id_"/> ! <index column="indx"/> ! <element type="net.sf.hibernate.test.DoubleStringType"> ! <column name="first_"/> ! <column name="second_"/> ! </element> ! </list> ! <list name="topComponents" table="topcomponents"> ! <jcs-cache usage="read-write"/> ! <key column="id_"/> ! <index column="i"/> ! <composite-element class="net.sf.hibernate.test.FooComponent"> ! <property name="name"/> ! <property name="count" column="count_"/> ! </composite-element> ! </list> ! ! <set name="topFoos"> ! <key column="idtopbar" /> ! <one-to-many class = "net.sf.hibernate.test.Bar"/> ! </set> ! ! <set name="cascadingBars" cascade="all"> ! <key column="idtopbar" /> ! <one-to-many class = "net.sf.hibernate.test.Bar"/> ! </set> ! ! <map name="topGlarchez"> ! <key column="idtopglarch" /> ! <index column="mapkey" type="character"/> ! <one-to-many class = "net.sf.hibernate.test.Glarch"/> ! </map> ! ! <set name="cached" sort="natural" table="cached_set"> ! <jcs-cache usage="read-write"/> ! <key column="baz"/> ! <composite-element class="net.sf.hibernate.test.CompositeElement"> ! <property name="foo"/> ! <property name="bar"/> ! </composite-element> ! </set> ! ! <map name="cachedMap" sort="natural" table="cached_map"> ! <jcs-cache usage="read-write"/> ! <key column="baz"/> ! <index-many-to-many column="another_baz" class="net.sf.hibernate.test.Baz"/> ! <composite-element class="net.sf.hibernate.test.CompositeElement"> ! <property name="foo"/> ! <property name="bar"/> ! </composite-element> ! </map> ! ! <map name="stringGlarchMap" where="baz_map_index > 'a' and tha_key is not null" cascade="all"> ! <key column="baz_map_id"/> ! <index column="baz_map_index" type="string"/> ! <one-to-many class="net.sf.hibernate.test.Glarch"/> ! </map> ! ! <map name="anyToAny" lazy="true"> ! <key column="baz"/> ! <index-many-to-any id-type="long"> ! <column name="ind_clazz_"/> ! <column name="ind_id_"/> ! </index-many-to-any> ! <many-to-any id-type="long"> ! <column name="el_clazz_"/> ! <column name="el_id_"/> ! </many-to-any> ! </map> ! </class> Index: Baz.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Baz.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Baz.java 21 Mar 2003 12:03:38 -0000 1.8 --- Baz.java 5 Apr 2003 07:13:38 -0000 1.9 *************** *** 41,44 **** --- 41,45 ---- private Map cachedMap; private Map stringGlarchMap; + private Map anyToAny; Baz() {} *************** *** 322,325 **** --- 323,342 ---- public void setStringGlarchMap(Map stringGlarchMap) { this.stringGlarchMap = stringGlarchMap; + } + + /** + * Returns the anyToAny. + * @return Map + */ + public Map getAnyToAny() { + return anyToAny; + } + + /** + * Sets the anyToAny. + * @param anyToAny The anyToAny to set + */ + public void setAnyToAny(Map anyToAny) { + this.anyToAny = anyToAny; } Index: Fee.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Fee.hbm.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Fee.hbm.xml 29 Mar 2003 07:36:22 -0000 1.6 --- Fee.hbm.xml 5 Apr 2003 07:13:38 -0000 1.7 *************** *** 16,20 **** <element column="str_" type="string"/> </set> ! <component name="compon"> <property name="name"/> <property name="null" column="null_prop"/> --- 16,20 ---- <element column="str_" type="string"/> </set> ! <component name="compon" update="false"> <property name="name"/> <property name="null" column="null_prop"/> Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** FooBarTest.java 4 Apr 2003 13:51:59 -0000 1.47 --- FooBarTest.java 5 Apr 2003 07:13:38 -0000 1.48 *************** *** 456,467 **** s.find("select max( elements(bar.baz.fooArray) ) from Bar as bar"); ! s.find("select count(*) from Baz as baz where 1 in indices(baz.fooArray)"); ! s.find("select count(*) from Bar as bar where 'abc' in elements(bar.baz.fooArray)"); ! s.find("select count(*) from Bar as bar where 1 in indices(bar.baz.fooArray)"); ! s.find("select count(*) from Bar as bar, bar.component.glarch.proxyArray as g where g.id in indices(bar.baz.fooArray)"); ! s.find("select max( elements(bar.baz.fooArray) ) from Bar as bar, bar.component.glarch.proxyArray as g where g.id in indices(bar.baz.fooArray)"); - s.find("select count(*) from Bar as bar where 1 in (from g in bar.component.glarch.proxyArray where g.name='foo')"); - s.find("select count(*) from Bar as bar left outer join bar.component.glarch.proxyArray as pg where 1 in (from g in bar.component.glarch.proxyArray)"); s.find("select baz.name from Bar bar inner join bar.baz baz inner join baz.fooSet foo where baz.name = bar.string"); --- 456,470 ---- s.find("select max( elements(bar.baz.fooArray) ) from Bar as bar"); ! //The following test is disabled for databases with no subselects...also for Interbase (not sure why). ! if ( !(dialect instanceof MySQLDialect) && !(dialect instanceof HSQLDialect) && !(dialect instanceof MckoiDialect) && !(dialect instanceof SAPDBDialect) && !(dialect instanceof PointbaseDialect) ) { ! s.find("select count(*) from Baz as baz where 1 in indices(baz.fooArray)"); ! s.find("select count(*) from Bar as bar where 'abc' in elements(bar.baz.fooArray)"); ! s.find("select count(*) from Bar as bar where 1 in indices(bar.baz.fooArray)"); ! s.find("select count(*) from Bar as bar, bar.component.glarch.proxyArray as g where g.id in indices(bar.baz.fooArray)"); ! s.find("select max( elements(bar.baz.fooArray) ) from Bar as bar, bar.component.glarch.proxyArray as g where g.id in indices(bar.baz.fooArray)"); ! s.find("select count(*) from Bar as bar where 1 in (from g in bar.component.glarch.proxyArray where g.name='foo')"); ! s.find("select count(*) from Bar as bar left outer join bar.component.glarch.proxyArray as pg where 1 in (from g in bar.component.glarch.proxyArray)"); ! } s.find("select baz.name from Bar bar inner join bar.baz baz inner join baz.fooSet foo where baz.name = bar.string"); *************** *** 1919,1922 **** --- 1922,1927 ---- Transaction tx = s.beginTransaction(); s.save(fee); + s.flush(); + fee.setCount(123); tx.commit(); s.close(); *************** *** 1929,1933 **** tx = s.beginTransaction(); assertTrue( s.find("from fee in class Fee").size()==0 ); - // s.delete(fee); tx.commit(); s.close(); --- 1934,1937 ---- Index: SQLFunctionsTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/SQLFunctionsTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SQLFunctionsTest.java 28 Feb 2003 07:01:29 -0000 1.6 --- SQLFunctionsTest.java 5 Apr 2003 07:13:38 -0000 1.7 *************** *** 162,165 **** --- 162,168 ---- public void testBlobClob() throws Exception { + + if (dialect instanceof MySQLDialect) return; + Session s = sessions.openSession(); Blobber b = new Blobber(); |
From: <one...@us...> - 2003-04-05 07:13:41
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv26924 Modified Files: hibernate-mapping-2.0.dtd Log Message: added many-to-any, index-many-to-any added update and insert attributes to component Index: hibernate-mapping-2.0.dtd =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-2.0.dtd,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** hibernate-mapping-2.0.dtd 29 Mar 2003 07:36:22 -0000 1.18 --- hibernate-mapping-2.0.dtd 5 Apr 2003 07:13:37 -0000 1.19 *************** *** 54,58 **** If a name attribut is given, the id is exposed to the application through the named property of the class. If not, the id is only exposed to the application ! through Session.getID()--> <!ELEMENT id (meta*, column*, generator)> --- 54,58 ---- If a name attribut is given, the id is exposed to the application through the named property of the class. If not, the id is only exposed to the application ! via Session.getIdentifier()--> <!ELEMENT id (meta*, column*, generator)> *************** *** 196,199 **** --- 196,202 ---- <!ATTLIST component class CDATA #IMPLIED> <!ATTLIST component name CDATA #REQUIRED> + <!ATTLIST component update (true|false) "true"> + <!ATTLIST component insert (true|false) "true"> + <!ELEMENT dynabean ( *************** *** 216,221 **** jcs-cache?, key, ! (index|composite-index|index-many-to-many), ! (element|one-to-many|many-to-many|composite-element) )> <!ATTLIST map name CDATA #REQUIRED> --- 219,224 ---- jcs-cache?, key, ! (index|composite-index|index-many-to-many|index-many-to-any), ! (element|one-to-many|many-to-many|composite-element|many-to-any) )> <!ATTLIST map name CDATA #REQUIRED> *************** *** 233,237 **** jcs-cache?, key, ! (element|one-to-many|many-to-many|composite-element) )> <!ATTLIST set name CDATA #REQUIRED> --- 236,240 ---- jcs-cache?, key, ! (element|one-to-many|many-to-many|composite-element|many-to-any) )> <!ATTLIST set name CDATA #REQUIRED> *************** *** 249,253 **** jcs-cache?, key, ! (element|one-to-many|many-to-many|composite-element) )> <!ATTLIST bag name CDATA #REQUIRED> --- 252,256 ---- jcs-cache?, key, ! (element|one-to-many|many-to-many|composite-element|many-to-any) )> <!ATTLIST bag name CDATA #REQUIRED> *************** *** 265,269 **** key, index, ! (element|one-to-many|many-to-many|composite-element) )> <!ATTLIST list name CDATA #REQUIRED> --- 268,272 ---- key, index, ! (element|one-to-many|many-to-many|composite-element|many-to-any) )> <!ATTLIST list name CDATA #REQUIRED> *************** *** 280,284 **** key, index, ! (element|one-to-many|many-to-many|composite-element) )> <!ATTLIST array name CDATA #REQUIRED> --- 283,287 ---- key, index, ! (element|one-to-many|many-to-many|composite-element|many-to-any) )> <!ATTLIST array name CDATA #REQUIRED> *************** *** 366,369 **** --- 369,382 ---- <!ELEMENT composite-index ( (key-property|key-many-to-one)+ )> <!ATTLIST composite-index class CDATA #REQUIRED> + + <!-- A "many to any" defines a polymorphic association to any table + with the given identifier type. The first listed column is a VARCHAR column + holding the name of the class (for that row). --> + + <!ELEMENT many-to-any (column, column+)> + <!ATTLIST many-to-any id-type CDATA #REQUIRED> + + <!ELEMENT index-many-to-any (column, column+)> + <!ATTLIST index-many-to-any id-type CDATA #REQUIRED> <!-- Generators generate unique identifiers. The class attribute specifies a Java class |
From: <one...@us...> - 2003-04-05 07:13:41
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg In directory sc8-pr-cvs1:/tmp/cvs-serv26924/cfg Modified Files: Binder.java Log Message: added many-to-any, index-many-to-any added update and insert attributes to component Index: Binder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg/Binder.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Binder.java 29 Mar 2003 07:36:22 -0000 1.11 --- Binder.java 5 Apr 2003 07:13:37 -0000 1.12 *************** *** 857,860 **** --- 857,865 ---- model.setIndex(component); } + else if ( "index-many-to-any".equals(name) ) { + Any any = new Any( model.getTable() ); + bindAny( subnode, any, model.isOneToMany() ); + model.setIndex(any); + } } if ( !model.isInverse() ) model.getIndex().createForeignKey(); *************** *** 909,912 **** --- 914,922 ---- bindComponent(subnode, element, null, model.getRole() + ".element", true, mappings); } + else if ( "many-to-any".equals(name) ) { + Any element = new Any( model.getTable() ); + model.setElement(element); + bindAny(subnode, element, true); + } else if ( "jcs-cache".equals(name) ) { model.setCache( Configuration.createJCSCache( |
From: <one...@us...> - 2003-04-05 07:13:41
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader In directory sc8-pr-cvs1:/tmp/cvs-serv26924/loader Modified Files: OuterJoinLoader.java Log Message: added many-to-any, index-many-to-any added update and insert attributes to component Index: OuterJoinLoader.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/OuterJoinLoader.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** OuterJoinLoader.java 15 Mar 2003 04:38:17 -0000 1.14 --- OuterJoinLoader.java 5 Apr 2003 07:13:38 -0000 1.15 *************** *** 233,237 **** tableName = StringHelper.unqualify(tableName); ! return new Alias( 5, Integer.toString(n) + StringHelper.UNDERSCORE ) .toAliasString(tableName); } --- 233,237 ---- tableName = StringHelper.unqualify(tableName); ! return new Alias( 7, Integer.toString(n) + StringHelper.UNDERSCORE ) .toAliasString(tableName); } |
From: <one...@us...> - 2003-04-04 16:43:20
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/src In directory sc8-pr-cvs1:/tmp/cvs-serv19920/reference/src Modified Files: toolset_guide.xml Log Message: improved schema export doc Index: toolset_guide.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/toolset_guide.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** toolset_guide.xml 3 Apr 2003 01:43:30 -0000 1.1 --- toolset_guide.xml 4 Apr 2003 16:43:16 -0000 1.2 *************** *** 5,9 **** Hibernate supports roundtrip engineering with a set of tools for DDL schema generation from a mapping file, mapping file generation ! from Java source code, Java class generation from a mapping file and a reverse engineering tool to generate Java classes and mapping files from an existing database schema. --- 5,9 ---- Hibernate supports roundtrip engineering with a set of tools for DDL schema generation from a mapping file, mapping file generation ! from Java classes, Java source generation from a mapping file and a reverse engineering tool to generate Java classes and mapping files from an existing database schema. *************** *** 19,23 **** <para> ! A schema can be generated from your mapping file/s through a command line utility: </para> --- 19,23 ---- <para> ! DDL can be generated from your mapping file/s by a command line utility: </para> *************** *** 126,132 **** <para> Some tags accept an <literal>index</literal> attribute for specifying the name of an index for that ! column. </para> ! <para> Examples: --- 126,133 ---- <para> Some tags accept an <literal>index</literal> attribute for specifying the name of an index for that ! column and a <literal>unique-key</literal> attribute for specifying the name of a multi-column unique ! key. </para> ! <para> Examples: *************** *** 163,166 **** --- 164,217 ---- </para> + <table frame="all"> + <title>Summary</title> + <tgroup cols="2"> + <colspec colwidth="1*"/> + <colspec colwidth="2.5*"/> + <thead> + <row> + <entry>Attribute</entry> + <entry>Values</entry> + <entry>Interpretation</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>length</literal></entry> + <entry><literal>true|false</literal></entry> + <entry>column length</entry> + </row> + <row> + <entry><literal>not-null</literal></entry> + <entry><literal>true|false</literal></entry> + <entry>specfies that the column should be non-nullable</entry> + </row> + <row> + <entry><literal>unique</literal></entry> + <entry><literal>true|false</literal></entry> + <entry>specifies that the column should have a unique constraint</entry> + </row> + <row> + <entry><literal>index</literal></entry> + <entry><literal>index_name</literal></entry> + <entry>specifies the name of a (multi-column) index</entry> + </row> + <row> + <entry><literal>unique-key</literal></entry> + <entry><literal>unique_key_name</literal></entry> + <entry>specifies the name of a multi-column unique constraint</entry> + </row> + <row> + <entry><literal>sql-type</literal></entry> + <entry><literal>column_type</literal></entry> + <entry> + overrides the default column type (attribute of + <literal><column></literal> element only) + </entry> + </row> + </tbody> + </tgroup> + </table> + </sect2> *************** *** 179,183 **** <table frame="all"> ! <title>SchemaExport Command Line Options</title> <tgroup cols="2"> <colspec colwidth="1.5*"/> --- 230,234 ---- <table frame="all"> ! <title><literal>SchemaExport</literal> Command Line Options</title> <tgroup cols="2"> <colspec colwidth="1.5*"/> *************** *** 223,231 **** <para> ! Optionally, you can control the <literal>SchemaExport</literal> tool in your application: </para> ! <programlisting><![CDATA[Datastore ds; ! new net.sf.hibernate.tool.hbm2ddl.SchemaExport(ds, properties).create(false, true);]]></programlisting> </sect2> --- 274,282 ---- <para> ! Optionally, you can embed <literal>SchemaExport</literal> in your actual application: </para> ! <programlisting><![CDATA[Datastore ds = ....; ! new SchemaExport(ds, properties).create(false, true);]]></programlisting> </sect2> *************** *** 240,244 **** <itemizedlist spacing="compact"> <listitem> ! <para>as system properties with -D<emphasis><property></emphasis></para> </listitem> <listitem> --- 291,295 ---- <itemizedlist spacing="compact"> <listitem> ! <para>as system properties with <literal>-D</literal><emphasis><property></emphasis></para> </listitem> <listitem> *************** *** 254,279 **** </para> ! <itemizedlist spacing="compact"> ! <listitem> ! <para><literal>hibernate.connection.driver = </literal> ! <emphasis>jdbc driver class</emphasis></para> ! </listitem> ! <listitem> ! <para><literal>hibernate.connection.url = </literal> ! <emphasis>jdbc url</emphasis></para> ! </listitem> ! <listitem> ! <para><literal>hibernate.connection.username = </literal> ! <emphasis>database user</emphasis></para> ! </listitem> ! <listitem> ! <para><literal>hibernate.connection.password = </literal> ! <emphasis>user password</emphasis></para> ! </listitem> ! <listitem> ! <para><literal>hibernate.dialect = </literal> ! <emphasis>dialect</emphasis></para> ! </listitem> ! </itemizedlist> </sect2> --- 305,343 ---- </para> ! <table frame="all"> ! <title>SchemaExport Connection Properties</title> ! <tgroup cols="2"> ! <colspec colwidth="1.5*"/> ! <colspec colwidth="2*"/> ! <thead> ! <row> ! <entry>Property Name</entry> ! <entry>Description</entry> ! </row> ! </thead> ! <tbody> ! <row> ! <entry><literal>hibernate.connection.driver</literal></entry> ! <entry>jdbc driver class</entry> ! </row> ! <row> ! <entry><literal>hibernate.connection.url</literal></entry> ! <entry>jdbc url</entry> ! </row> ! <row> ! <entry><literal>hibernate.connection.username</literal></entry> ! <entry>database user</entry> ! </row> ! <row> ! <entry><literal>hibernate.connection.password</literal></entry> ! <entry>user password</entry> ! </row> ! <row> ! <entry><literal>hibernate.dialect</literal></entry> ! <entry>dialect</entry> ! </row> ! </tbody> ! </tgroup> ! </table> </sect2> *************** *** 283,288 **** <para> ! You can call the <literal>SchemaExport</literal> tool from your Ant build ! script: </para> --- 347,351 ---- <para> ! You can call <literal>SchemaExport</literal> from your Ant build script: </para> |