You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
| 2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
| 2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
| 2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
| 2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
| 2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
| 2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <one...@us...> - 2003-01-25 09:30:32
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/type
In directory sc8-pr-cvs1:/tmp/cvs-serv25897/type
Modified Files:
BlobType.java ClobType.java
Log Message:
added createClob(), createBlob() for streams
Index: BlobType.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/type/BlobType.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BlobType.java 25 Dec 2002 02:00:15 -0000 1.2
--- BlobType.java 25 Jan 2003 09:30:29 -0000 1.3
***************
*** 1,7 ****
//$Id$
-
package cirrus.hibernate.type;
! import java.sql.*;
import cirrus.hibernate.HibernateException;
--- 1,10 ----
//$Id$
package cirrus.hibernate.type;
! import java.sql.Blob;
! import java.sql.PreparedStatement;
! import java.sql.ResultSet;
! import java.sql.SQLException;
! import java.sql.Types;
import cirrus.hibernate.HibernateException;
***************
*** 12,16 ****
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
if (value instanceof BlobImpl) {
! st.setBytes(index, ( (BlobImpl) value ).toBytes() );
}
else {
--- 15,20 ----
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
if (value instanceof BlobImpl) {
! BlobImpl blob = (BlobImpl) value;
! st.setBinaryStream( index, blob.getBinaryStream(), (int) blob.length() );
}
else {
Index: ClobType.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/type/ClobType.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ClobType.java 25 Dec 2002 02:00:15 -0000 1.2
--- ClobType.java 25 Jan 2003 09:30:29 -0000 1.3
***************
*** 1,7 ****
//$Id$
-
package cirrus.hibernate.type;
! import java.sql.*;
import cirrus.hibernate.HibernateException;
--- 1,10 ----
//$Id$
package cirrus.hibernate.type;
! import java.sql.Clob;
! import java.sql.PreparedStatement;
! import java.sql.ResultSet;
! import java.sql.SQLException;
! import java.sql.Types;
import cirrus.hibernate.HibernateException;
***************
*** 11,17 ****
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
! if (value instanceof ClobImpl) {
! st.setString( index, ( (ClobImpl) value ).toString() );
! }
else {
st.setClob(index, (Clob) value);
--- 14,21 ----
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
! if (value instanceof ClobImpl) {
! ClobImpl clob = (ClobImpl) value;
! st.setCharacterStream( index, clob.getCharacterStream(), (int) clob.length() );
! }
else {
st.setClob(index, (Clob) value);
***************
*** 24,28 ****
public int sqlType() {
! return Types.VARCHAR; //TODO: Types.CLOB
}
--- 28,32 ----
public int sqlType() {
! return Types.CLOB;
}
|
|
From: <one...@us...> - 2003-01-25 09:30:32
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/lob
In directory sc8-pr-cvs1:/tmp/cvs-serv25897/lob
Modified Files:
BlobImpl.java ClobImpl.java
Log Message:
added createClob(), createBlob() for streams
Index: BlobImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/lob/BlobImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** BlobImpl.java 25 Dec 2002 02:00:15 -0000 1.1
--- BlobImpl.java 25 Jan 2003 09:30:29 -0000 1.2
***************
*** 10,30 ****
public class BlobImpl implements Blob {
! private byte[] bytes;
!
! public byte[] toBytes() {
! return bytes;
}
! public BlobImpl(byte[] bytes) {
! this.bytes = bytes;
}
!
/**
* @see java.sql.Blob#length()
*/
public long length() throws SQLException {
! return bytes.length;
}
!
/**
* @see java.sql.Blob#truncate(long)
--- 10,33 ----
public class BlobImpl implements Blob {
! private InputStream stream;
! private int length;
!
! public BlobImpl(byte[] bytes) {
! this.stream = new ByteArrayInputStream(bytes);
! this.length = bytes.length;
}
! public BlobImpl(InputStream stream, int length) {
! this.stream = stream;
! this.length = length;
}
!
/**
* @see java.sql.Blob#length()
*/
public long length() throws SQLException {
! return length;
}
!
/**
* @see java.sql.Blob#truncate(long)
***************
*** 67,71 ****
*/
public InputStream getBinaryStream() throws SQLException {
! return new ByteArrayInputStream(bytes);
}
--- 70,74 ----
*/
public InputStream getBinaryStream() throws SQLException {
! return stream;
}
Index: ClobImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/lob/ClobImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ClobImpl.java 25 Dec 2002 02:00:15 -0000 1.1
--- ClobImpl.java 25 Jan 2003 09:30:29 -0000 1.2
***************
*** 2,10 ****
package cirrus.hibernate.lob;
- import java.io.CharArrayReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
! import java.io.StringBufferInputStream;
import java.io.Writer;
import java.sql.Clob;
--- 2,9 ----
package cirrus.hibernate.lob;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
! import java.io.StringReader;
import java.io.Writer;
import java.sql.Clob;
***************
*** 13,33 ****
public class ClobImpl implements Clob {
! private char[] chars;
public ClobImpl(String string) {
! chars = string.toCharArray();
! }
!
! public String toString() {
! return new String(chars);
}
/**
* @see java.sql.Clob#length()
*/
public long length() throws SQLException {
! return chars.length;
}
!
/**
* @see java.sql.Clob#truncate(long)
--- 12,35 ----
public class ClobImpl implements Clob {
! private Reader reader;
! private int length;
public ClobImpl(String string) {
! reader = new StringReader(string);
! length = string.length();
}
+ public ClobImpl(Reader reader, int length) {
+ this.reader = reader;
+ this.length = length;
+ }
+
/**
* @see java.sql.Clob#length()
*/
public long length() throws SQLException {
! return length;
}
!
/**
* @see java.sql.Clob#truncate(long)
***************
*** 41,45 ****
*/
public InputStream getAsciiStream() throws SQLException {
! return new StringBufferInputStream( new String(chars) );
}
--- 43,47 ----
*/
public InputStream getAsciiStream() throws SQLException {
! excep(); return null;
}
***************
*** 55,59 ****
*/
public Reader getCharacterStream() throws SQLException {
! return new CharArrayReader(chars);
}
--- 57,61 ----
*/
public Reader getCharacterStream() throws SQLException {
! return reader;
}
|
|
From: <one...@us...> - 2003-01-25 01:26:11
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type
In directory sc8-pr-cvs1:/tmp/cvs-serv30516/sf/hibernate/type
Modified Files:
CustomType.java
Log Message:
support for immutable properties and dynamic-update for <joined-subclass> mappings
Index: CustomType.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/CustomType.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CustomType.java 19 Jan 2003 11:47:08 -0000 1.4
--- CustomType.java 25 Jan 2003 01:26:07 -0000 1.5
***************
*** 77,149 ****
String[] names,
SessionImplementor session,
! Object owner)
! throws HibernateException, SQLException {
!
! return userType.nullSafeGet(rs, names, owner);
! }
!
! /**
! * @see net.sf.hibernate.type.Type#nullSafeGet(ResultSet, String, SessionImplementor, Object)
! */
! public Object nullSafeGet(
! ResultSet rs,
! String name,
! SessionImplementor session,
! Object owner)
! throws HibernateException, SQLException {
!
! return nullSafeGet(rs, new String[] { name }, session, owner);
! }
!
! /**
! * @see net.sf.hibernate.type.Type#nullSafeSet(PreparedStatement, Object, int, SessionImplementor)
! */
! public void nullSafeSet(
! PreparedStatement st,
! Object value,
! int index,
! SessionImplementor session)
! throws HibernateException, SQLException {
!
! userType.nullSafeSet(st, value, index);
! }
!
! /**
! * @see net.sf.hibernate.type.Type#toXML(Object, SessionFactoryImplementor)
! */
! public String toXML(Object value, SessionFactoryImplementor factory) {
! return value.toString();
! }
!
! /**
! * @see net.sf.hibernate.type.Type#getName()
! */
! public String getName() {
! return name;
! }
!
! /**
! * @see net.sf.hibernate.type.Type#deepCopy(Object)
! */
! public Object deepCopy(Object value) {
! return userType.deepCopy(value);
! }
!
! /**
! * @see net.sf.hibernate.type.Type#isMutable()
! */
! public boolean isMutable() {
! return userType.isMutable();
! }
!
! public boolean hasNiceEquals() {
! return false;
! }
!
! }
!
!
!
--- 77,149 ----
String[] names,
SessionImplementor session,
! Object owner
! ) throws HibernateException, SQLException {
+ return userType.nullSafeGet(rs, names, owner);
+ }
+
+ /**
+ * @see net.sf.hibernate.type.Type#nullSafeGet(ResultSet, String, SessionImplementor, Object)
+ */
+ public Object nullSafeGet(
+ ResultSet rs,
+ String name,
+ SessionImplementor session,
+ Object owner
+ ) throws HibernateException, SQLException {
+ return nullSafeGet(rs, new String[] { name }, session, owner);
+ }
+
+ /**
+ * @see net.sf.hibernate.type.Type#nullSafeSet(PreparedStatement, Object, int, SessionImplementor)
+ */
+ public void nullSafeSet(
+ PreparedStatement st,
+ Object value,
+ int index,
+ SessionImplementor session
+ ) throws HibernateException, SQLException {
+ userType.nullSafeSet(st, value, index);
+ }
+
+ /**
+ * @see net.sf.hibernate.type.Type#toXML(Object, SessionFactoryImplementor)
+ */
+ public String toXML(Object value, SessionFactoryImplementor factory) {
+ return value.toString();
+ }
+
+ /**
+ * @see net.sf.hibernate.type.Type#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @see net.sf.hibernate.type.Type#deepCopy(Object)
+ */
+ public Object deepCopy(Object value) {
+ return userType.deepCopy(value);
+ }
+
+ /**
+ * @see net.sf.hibernate.type.Type#isMutable()
+ */
+ public boolean isMutable() {
+ return userType.isMutable();
+ }
+
+ public boolean hasNiceEquals() {
+ return false;
+ }
+
+ }
+
+
+
+
+
+
|
|
From: <one...@us...> - 2003-01-25 01:26:11
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv30516/sf/hibernate/test Modified Files: Multi.hbm.xml Log Message: support for immutable properties and dynamic-update for <joined-subclass> mappings Index: Multi.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Multi.hbm.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Multi.hbm.xml 24 Jan 2003 13:07:17 -0000 1.2 --- Multi.hbm.xml 25 Jan 2003 01:26:07 -0000 1.3 *************** *** 35,39 **** </joined-subclass> ! <joined-subclass name="net.sf.hibernate.test.Multi" table="nonleafsubclass"> <key column="sid"/> <property name="extraProp"/> --- 35,39 ---- </joined-subclass> ! <joined-subclass name="net.sf.hibernate.test.Multi" table="nonleafsubclass" dynamic-update="true"> <key column="sid"/> <property name="extraProp"/> |
|
From: <one...@us...> - 2003-01-25 01:26:11
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister
In directory sc8-pr-cvs1:/tmp/cvs-serv30516/sf/hibernate/persister
Modified Files:
EntityPersister.java NormalizedEntityPersister.java
Log Message:
support for immutable properties and dynamic-update for <joined-subclass> mappings
Index: EntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/EntityPersister.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** EntityPersister.java 25 Jan 2003 00:13:55 -0000 1.11
--- EntityPersister.java 25 Jan 2003 01:26:07 -0000 1.12
***************
*** 412,415 ****
--- 412,416 ----
}
+ //TODO: precalculate this
private boolean[] allProperties() {
boolean[] result = new boolean[hydrateSpan];
***************
*** 560,564 ****
if ( dirtyFields[j]==i ) dirty=true;
}
! propsToUpdate[i] = ( dirty && getPropertyMutability()[i] ) || getVersionProperty()==i;
}
update(id, fields, propsToUpdate, oldVersion, object, generateUpdateString(propsToUpdate), session);
--- 561,566 ----
if ( dirtyFields[j]==i ) dirty=true;
}
! propsToUpdate[i] = dirty || getVersionProperty()==i;
! //don't need to check property mutability (dirty checking algorithm handles that)
}
update(id, fields, propsToUpdate, oldVersion, object, generateUpdateString(propsToUpdate), session);
Index: NormalizedEntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/NormalizedEntityPersister.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** NormalizedEntityPersister.java 24 Jan 2003 13:07:17 -0000 1.3
--- NormalizedEntityPersister.java 25 Jan 2003 01:26:07 -0000 1.4
***************
*** 21,24 ****
--- 21,25 ----
import java.sql.SQLException;
import java.util.ArrayList;
+ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
***************
*** 293,297 ****
* Generate the SQL that updates a row by id (and version)
*/
! protected String[] generateUpdateStrings() {
String[] result = new String[ tableNames.length ];
for ( int j=0; j<tableNames.length; j++ ) {
--- 294,298 ----
* Generate the SQL that updates a row by id (and version)
*/
! protected String[] generateUpdateStrings(boolean[] includeProperty) {
String[] result = new String[ tableNames.length ];
for ( int j=0; j<tableNames.length; j++ ) {
***************
*** 302,306 ****
boolean hasColumns = false;
for (int i=0; i<propertyColumnNames.length; i++) {
! if ( propertyTables[i]==j ) {
update.addColumns( propertyColumnNames[i] );
hasColumns = hasColumns || propertyColumnNames[i].length > 0;
--- 303,307 ----
boolean hasColumns = false;
for (int i=0; i<propertyColumnNames.length; i++) {
! if ( includeProperty[i] && propertyTables[i]==j ) {
update.addColumns( propertyColumnNames[i] );
hasColumns = hasColumns || propertyColumnNames[i].length > 0;
***************
*** 330,334 ****
* Marshall the fields of a persistent instance to a prepared statement
*/
! protected int dehydrate(Serializable id, Object[] fields, PreparedStatement[] statements, SessionImplementor session) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) log.trace("Dehydrating entity: " + getClassName() + '#' + id);
--- 331,335 ----
* Marshall the fields of a persistent instance to a prepared statement
*/
! protected int dehydrate(Serializable id, Object[] fields, boolean[] includeProperty, PreparedStatement[] statements, SessionImplementor session) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) log.trace("Dehydrating entity: " + getClassName() + '#' + id);
***************
*** 337,341 ****
for ( int i=0; i<tableNames.length; i++ ) {
! int index = dehydrate(id, fields, i, statements[i], session);
if (i==0) versionParam = index;
}
--- 338,342 ----
for ( int i=0; i<tableNames.length; i++ ) {
! int index = dehydrate(id, fields, includeProperty, i, statements[i], session);
if (i==0) versionParam = index;
}
***************
*** 345,349 ****
}
! private int dehydrate(Serializable id, Object[] fields, int table, PreparedStatement statement, SessionImplementor session) throws SQLException, HibernateException {
if (statement==null) return -1;
--- 346,350 ----
}
! private int dehydrate(Serializable id, Object[] fields, boolean[] includeProperty, int table, PreparedStatement statement, SessionImplementor session) throws SQLException, HibernateException {
if (statement==null) return -1;
***************
*** 353,357 ****
for (int j=0; j<hydrateSpan; j++) {
! if ( propertyTables[j]==table ) {
getPropertyTypes()[j].nullSafeSet( statement, fields[j], index, session );
index += propertyColumnSpans[j];
--- 354,358 ----
for (int j=0; j<hydrateSpan; j++) {
! if ( includeProperty[j] && propertyTables[j]==table ) {
getPropertyTypes()[j].nullSafeSet( statement, fields[j], index, session );
index += propertyColumnSpans[j];
***************
*** 424,427 ****
--- 425,435 ----
}
+ //TODO: precalculate this
+ private boolean[] allProperties() {
+ boolean[] result = new boolean[hydrateSpan];
+ Arrays.fill(result, true);
+ return result;
+ }
+
/**
* Persist an object
***************
*** 445,449 ****
// insert was issued (cos of foreign key constraints). Not necessarily the object's current state
! dehydrate(id, fields, statements, session);
for ( int i=0; i<tableNames.length; i++ ) statements[i].executeUpdate();
--- 453,457 ----
// insert was issued (cos of foreign key constraints). Not necessarily the object's current state
! dehydrate(id, fields, allProperties(), statements, session);
for ( int i=0; i<tableNames.length; i++ ) statements[i].executeUpdate();
***************
*** 476,480 ****
PreparedStatement statement = session.getBatcher().prepareStatement( sql[0] );
try {
! dehydrate(null, fields, 0, statement, session);
statement.executeUpdate();
}
--- 484,488 ----
PreparedStatement statement = session.getBatcher().prepareStatement( sql[0] );
try {
! dehydrate(null, fields, allProperties(), 0, statement, session);
statement.executeUpdate();
}
***************
*** 516,520 ****
try {
! dehydrate(id, fields, i, statement, session);
statement.executeUpdate();
}
--- 524,528 ----
try {
! dehydrate(id, fields, allProperties(), i, statement, session);
statement.executeUpdate();
}
***************
*** 579,585 ****
*/
public void update(Serializable id, Object[] fields, int[] dirtyFields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException {
!
! int tables = tableNames.length;
!
boolean[] tableUpdateNeeded;
if (dirtyFields==null) {
--- 587,591 ----
*/
public void update(Serializable id, Object[] fields, int[] dirtyFields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException {
!
boolean[] tableUpdateNeeded;
if (dirtyFields==null) {
***************
*** 587,591 ****
}
else {
! tableUpdateNeeded = new boolean[tables];
for ( int i=0; i<dirtyFields.length; i++ ) {
tableUpdateNeeded[ propertyTables[ dirtyFields[i] ] ] = true;
--- 593,597 ----
}
else {
! tableUpdateNeeded = new boolean[tableNames.length];
for ( int i=0; i<dirtyFields.length; i++ ) {
tableUpdateNeeded[ propertyTables[ dirtyFields[i] ] ] = true;
***************
*** 593,596 ****
--- 599,620 ----
if ( isVersioned() ) tableUpdateNeeded[0] = true;
}
+
+ if ( useDynamicUpdate() && dirtyFields!=null ) {
+ boolean[] propsToUpdate = new boolean[hydrateSpan];
+ for ( int i=0; i<hydrateSpan; i++ ) {
+ boolean dirty=false;
+ for (int j=0; j<dirtyFields.length; j++) {
+ if ( dirtyFields[j]==i ) dirty=true;
+ }
+ propsToUpdate[i] = dirty || getVersionProperty()==i;
+ }
+ update(id, fields, propsToUpdate, tableUpdateNeeded, oldVersion, object, generateUpdateStrings(propsToUpdate), session);
+ }
+ else {
+ update(id, fields, getPropertyMutability(), tableUpdateNeeded, oldVersion, object, sqlUpdate(), session);
+ }
+ }
+
+ protected void update(Serializable id, Object[] fields, boolean[] includeProperty, boolean[] includeTable, Object oldVersion, Object object, String[] sql, SessionImplementor session) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) {
***************
*** 599,615 ****
}
final PreparedStatement[] statements = new PreparedStatement[tables];
try {
! for ( int i=0; i<tableNames.length; i++ ) {
! if ( tableUpdateNeeded[i] ) statements[i] = session.getBatcher().prepareStatement( sqlUpdate()[i] );
}
! int versionParam = dehydrate(id, fields, statements, session);
if ( isVersioned() ) getVersionType().nullSafeSet( statements[0], oldVersion, versionParam, session );
for ( int i=0; i<tables; i++ ) {
! if ( tableUpdateNeeded[i] ) check( statements[i].executeUpdate(), id );
}
--- 623,641 ----
}
+ int tables = tableNames.length;
+
final PreparedStatement[] statements = new PreparedStatement[tables];
try {
! for ( int i=0; i<tables; i++ ) {
! if ( includeTable[i] ) statements[i] = session.getBatcher().prepareStatement( sql[i] );
}
! int versionParam = dehydrate(id, fields, includeProperty, statements, session);
if ( isVersioned() ) getVersionType().nullSafeSet( statements[0], oldVersion, versionParam, session );
for ( int i=0; i<tables; i++ ) {
! if ( includeTable[i] ) check( statements[i].executeUpdate(), id );
}
***************
*** 620,624 ****
}
finally {
! for ( int i=0; i<tableNames.length; i++ ) {
if ( statements[i]!=null ) session.getBatcher().closeStatement( statements[i] );
}
--- 646,650 ----
}
finally {
! for ( int i=0; i<tables; i++ ) {
if ( statements[i]!=null ) session.getBatcher().closeStatement( statements[i] );
}
***************
*** 804,808 ****
insertStrings = generateInsertStrings(false);
identityInsertStrings = isIdentifierAssignedByInsert() ? generateInsertStrings(true) : null;
! updateStrings = generateUpdateStrings();
String lockString = generateLockString();
--- 830,834 ----
insertStrings = generateInsertStrings(false);
identityInsertStrings = isIdentifierAssignedByInsert() ? generateInsertStrings(true) : null;
! updateStrings = generateUpdateStrings( getPropertyMutability() );
String lockString = generateLockString();
|
|
From: <one...@us...> - 2003-01-25 00:13:59
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test
In directory sc8-pr-cvs1:/tmp/cvs-serv7859/sf/hibernate/test
Modified Files:
FooBar.hbm.xml
Log Message:
implemented dynamic-update for EntityPersister
Index: FooBar.hbm.xml
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBar.hbm.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** FooBar.hbm.xml 18 Jan 2003 09:57:36 -0000 1.4
--- FooBar.hbm.xml 25 Jan 2003 00:13:56 -0000 1.5
***************
*** 8,12 ****
table="foos"
proxy="net.sf.hibernate.test.FooProxy"
! discriminator-value="F">
<!--<jcs-cache usage="read-write"/>-->
--- 8,13 ----
table="foos"
proxy="net.sf.hibernate.test.FooProxy"
! discriminator-value="F"
! dynamic-update="true">
<!--<jcs-cache usage="read-write"/>-->
|
|
From: <one...@us...> - 2003-01-25 00:13:59
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister
In directory sc8-pr-cvs1:/tmp/cvs-serv7859/sf/hibernate/persister
Modified Files:
AbstractEntityPersister.java EntityPersister.java
Log Message:
implemented dynamic-update for EntityPersister
Index: AbstractEntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/AbstractEntityPersister.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** AbstractEntityPersister.java 24 Jan 2003 16:15:58 -0000 1.7
--- AbstractEntityPersister.java 25 Jan 2003 00:13:55 -0000 1.8
***************
*** 76,79 ****
--- 76,80 ----
private transient final boolean useIdentityColumn;
private transient final Class superclass;
+ private transient final boolean dynamicUpdate;
private transient final String identitySelectString;
***************
*** 462,465 ****
--- 463,467 ----
mutable = model.isMutable();
+ dynamicUpdate = model.useDynamicUpdate();
polymorphic = model.isPolymorphic();
***************
*** 696,699 ****
--- 698,705 ----
public boolean[] getPropertyMutability() {
return propertyMutability;
+ }
+
+ protected boolean useDynamicUpdate() {
+ return dynamicUpdate;
}
Index: EntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/EntityPersister.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** EntityPersister.java 24 Jan 2003 16:15:59 -0000 1.10
--- EntityPersister.java 25 Jan 2003 00:13:55 -0000 1.11
***************
*** 553,560 ****
*/
public void update(Serializable id, Object[] fields, int[] dirtyFields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException {
! doUpdate(id, fields, getPropertyMutability(), oldVersion, object, sqlUpdate(), session);
}
! protected void doUpdate(Serializable id, Object[] fields, boolean[] includeProperty, Object oldVersion, Object object, String sql, SessionImplementor session) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) {
log.trace("Updating entity: " + getClassName() + '#' + id);
--- 553,573 ----
*/
public void update(Serializable id, Object[] fields, int[] dirtyFields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException {
! if ( useDynamicUpdate() && dirtyFields!=null ) {
! boolean[] propsToUpdate = new boolean[hydrateSpan];
! for ( int i=0; i<hydrateSpan; i++ ) {
! boolean dirty=false;
! for (int j=0; j<dirtyFields.length; j++) {
! if ( dirtyFields[j]==i ) dirty=true;
! }
! propsToUpdate[i] = ( dirty && getPropertyMutability()[i] ) || getVersionProperty()==i;
! }
! update(id, fields, propsToUpdate, oldVersion, object, generateUpdateString(propsToUpdate), session);
! }
! else {
! update(id, fields, getPropertyMutability(), oldVersion, object, sqlUpdate(), session);
! }
}
! protected void update(Serializable id, Object[] fields, boolean[] includeProperty, Object oldVersion, Object object, String sql, SessionImplementor session) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) {
log.trace("Updating entity: " + getClassName() + '#' + id);
|
|
From: <one...@us...> - 2003-01-25 00:13:58
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping
In directory sc8-pr-cvs1:/tmp/cvs-serv7859/sf/hibernate/mapping
Modified Files:
PersistentClass.java
Log Message:
implemented dynamic-update for EntityPersister
Index: PersistentClass.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/PersistentClass.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** PersistentClass.java 19 Jan 2003 11:47:07 -0000 1.6
--- PersistentClass.java 25 Jan 2003 00:13:55 -0000 1.7
***************
*** 25,28 ****
--- 25,29 ----
private final ArrayList subclassTables = new ArrayList();
private Class proxyInterface; //can be final
+ private final boolean dynamicUpdate;
protected PersistentClass(Node node) throws MappingException {
***************
*** 49,53 ****
Node discriminatorNode = atts.getNamedItem("discriminator-value");
discriminatorValue = (discriminatorNode==null) ? className : discriminatorNode.getNodeValue();
!
}
--- 50,60 ----
Node discriminatorNode = atts.getNamedItem("discriminator-value");
discriminatorValue = (discriminatorNode==null) ? className : discriminatorNode.getNodeValue();
! //DYNAMIC UPDATE
! Node dynamicNode = atts.getNamedItem("dynamic-update");
! dynamicUpdate = (dynamicNode==null) ? false : "true".equals( dynamicNode.getNodeValue() );
! }
!
! public boolean useDynamicUpdate() {
! return dynamicUpdate;
}
|
|
From: <one...@us...> - 2003-01-25 00:13:58
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate
In directory sc8-pr-cvs1:/tmp/cvs-serv7859/sf/hibernate
Modified Files:
hibernate-mapping-2.0.dtd
Log Message:
implemented dynamic-update for EntityPersister
Index: hibernate-mapping-2.0.dtd
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-2.0.dtd,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** hibernate-mapping-2.0.dtd 24 Jan 2003 16:15:54 -0000 1.11
--- hibernate-mapping-2.0.dtd 25 Jan 2003 00:13:55 -0000 1.12
***************
*** 42,45 ****
--- 42,46 ----
<!ATTLIST class polymorphism (implicit|explicit) "implicit">
<!ATTLIST class persister CDATA #IMPLIED>
+ <!ATTLIST class dynamic-update (true|false) "false">
<!-- Declares the id type, column and generation algorithm for an entity class.
***************
*** 95,98 ****
--- 96,100 ----
<!ATTLIST subclass proxy CDATA #IMPLIED> <!-- default: no proxy interface -->
<!ATTLIST subclass discriminator-value CDATA #IMPLIED> <!-- default: unqualified class name | none -->
+ <!ATTLIST subclass dynamic-update (true|false) "false">
<!-- Joined subclasses are used for the normalized table-per-subclass mapping strategy -->
***************
*** 108,111 ****
--- 110,114 ----
<!ATTLIST joined-subclass table CDATA #IMPLIED> <!-- default: unqualified class name -->
<!ATTLIST joined-subclass schema CDATA #IMPLIED>
+ <!ATTLIST joined-subclass dynamic-update (true|false) "false">
<!-- Property of an entity class or component, component-element, composite-id, etc.
|
|
From: <one...@us...> - 2003-01-24 16:16:40
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test
In directory sc8-pr-cvs1:/tmp/cvs-serv13407/sf/hibernate/test
Modified Files:
CustomPersister.java Glarch.hbm.xml Glarch.java
Log Message:
added mutable attribute to <property> element
Index: CustomPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/CustomPersister.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CustomPersister.java 9 Jan 2003 12:24:51 -0000 1.4
--- CustomPersister.java 24 Jan 2003 16:16:00 -0000 1.5
***************
*** 349,352 ****
--- 349,353 ----
Type[] TYPES = new Type[] { Hibernate.STRING };
String[] NAMES = new String[] { "name" };
+ boolean[] MUTABILITY = new boolean[] { true };
/**
***************
*** 434,438 ****
}
! }
--- 435,446 ----
}
! /**
! * @see net.sf.hibernate.persister.ClassPersister#getPropertyMutability()
! */
! public boolean[] getPropertyMutability() {
! return MUTABILITY;
! }
!
! }
Index: Glarch.hbm.xml
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Glarch.hbm.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Glarch.hbm.xml 19 Jan 2003 11:47:08 -0000 1.2
--- Glarch.hbm.xml 24 Jan 2003 16:16:01 -0000 1.3
***************
*** 44,47 ****
--- 44,48 ----
<one-to-many class="net.sf.hibernate.test.Glarch"/>
</set>
+ <property name="immutable" mutable="false"/>
</class>
Index: Glarch.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Glarch.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Glarch.java 19 Jan 2003 11:47:08 -0000 1.4
--- Glarch.java 24 Jan 2003 16:16:02 -0000 1.5
***************
*** 30,33 ****
--- 30,34 ----
//private Currency currency = Currency.getInstance( Locale.getDefault() );
private transient DynaBean dynaBean;
+ private String immutable;
public int getVersion() {
***************
*** 127,130 ****
--- 128,132 ----
dynaBean.set("foo", "foo");
dynaBean.set("bar", new Integer(66));
+ immutable="never changes!";
return NO_VETO;
}
***************
*** 156,159 ****
--- 158,177 ----
public void setDynaBean(DynaBean dynaBean) {
this.dynaBean = dynaBean;
+ }
+
+ /**
+ * Returns the immutable.
+ * @return String
+ */
+ public String getImmutable() {
+ return immutable;
+ }
+
+ /**
+ * Sets the immutable.
+ * @param immutable The immutable to set
+ */
+ public void setImmutable(String immutable) {
+ this.immutable = immutable;
}
|
|
From: <one...@us...> - 2003-01-24 16:16:39
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type
In directory sc8-pr-cvs1:/tmp/cvs-serv13407/sf/hibernate/type
Modified Files:
TypeFactory.java
Log Message:
added mutable attribute to <property> element
Index: TypeFactory.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/TypeFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TypeFactory.java 5 Jan 2003 02:11:24 -0000 1.4
--- TypeFactory.java 24 Jan 2003 16:16:03 -0000 1.5
***************
*** 184,190 ****
* Deep copy values in the first array into the second
*/
! public static void deepCopy(Object[] values, Type[] types, Object[] target) throws HibernateException {
for ( int i=0; i<types.length; i++ ) {
! target[i] = types[i].deepCopy( values[i] );
}
}
--- 184,190 ----
* Deep copy values in the first array into the second
*/
! public static void deepCopy(Object[] values, Type[] types, boolean[] copy, Object[] target) throws HibernateException {
for ( int i=0; i<types.length; i++ ) {
! if ( copy[i] ) target[i] = types[i].deepCopy( values[i] );
}
}
***************
*** 194,202 ****
* the dirty fields or <tt>null</tt> if no fields are dirty.
*/
! public static int[] findDirty(Type[] types, Object[] x, Object[] y, Object owner, SessionFactoryImplementor factory) throws HibernateException {
int[] results = null;
int count = 0;
for (int i=0; i<types.length; i++) {
! if ( types[i].isDirty( x[i], y[i], owner, factory ) ) {
if (results==null) results = new int[ types.length ];
results[count++]=i;
--- 194,202 ----
* the dirty fields or <tt>null</tt> if no fields are dirty.
*/
! public static int[] findDirty(Type[] types, Object[] x, Object[] y, boolean[] check, Object owner, SessionFactoryImplementor factory) throws HibernateException {
int[] results = null;
int count = 0;
for (int i=0; i<types.length; i++) {
! if ( check[i] && types[i].isDirty( x[i], y[i], owner, factory ) ) {
if (results==null) results = new int[ types.length ];
results[count++]=i;
|
|
From: <one...@us...> - 2003-01-24 16:16:36
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister
In directory sc8-pr-cvs1:/tmp/cvs-serv13407/sf/hibernate/persister
Modified Files:
AbstractEntityPersister.java ClassPersister.java
EntityPersister.java
Log Message:
added mutable attribute to <property> element
Index: AbstractEntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/AbstractEntityPersister.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AbstractEntityPersister.java 24 Jan 2003 13:07:17 -0000 1.6
--- AbstractEntityPersister.java 24 Jan 2003 16:15:58 -0000 1.7
***************
*** 100,103 ****
--- 100,104 ----
private transient final String[] propertyNames;
private transient final Type[] propertyTypes;
+ private transient final boolean[] propertyMutability;
private transient final String versionPropertyName;
***************
*** 243,247 ****
*/
public int[] findDirty(Object[] x, Object[] y, Object owner, SessionImplementor session) throws HibernateException {
! int[] props = TypeFactory.findDirty( propertyTypes, x, y, owner, session.getFactory() );
if ( props==null) {
return null;
--- 244,248 ----
*/
public int[] findDirty(Object[] x, Object[] y, Object owner, SessionImplementor session) throws HibernateException {
! int[] props = TypeFactory.findDirty( propertyTypes, x, y, propertyMutability, owner, session.getFactory() );
if ( props==null) {
return null;
***************
*** 601,604 ****
--- 602,606 ----
propertyTypes = new Type[hydrateSpan];
propertyNames = new String[hydrateSpan];
+ propertyMutability = new boolean[hydrateSpan];
getters = new ReflectHelper.Getter[hydrateSpan];
setters = new ReflectHelper.Setter[hydrateSpan];
***************
*** 617,620 ****
--- 619,623 ----
setters[i] = ReflectHelper.getSetter( mappedClass, propertyNames[i] );
propertyTypes[i] = prop.getType();
+ propertyMutability[i] = prop.isMutable();
cascadeStyles[i] = prop.cascade();
***************
*** 691,694 ****
--- 694,701 ----
}
+ public boolean[] getPropertyMutability() {
+ return propertyMutability;
+ }
+
}
Index: ClassPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/ClassPersister.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ClassPersister.java 15 Jan 2003 12:49:01 -0000 1.4
--- ClassPersister.java 24 Jan 2003 16:15:59 -0000 1.5
***************
*** 235,238 ****
--- 235,240 ----
public String[] getPropertyNames();
+ public boolean[] getPropertyMutability();
+
/**
* Get the cascade styles of the propertes (optional operation)
Index: EntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/EntityPersister.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** EntityPersister.java 24 Jan 2003 13:07:17 -0000 1.9
--- EntityPersister.java 24 Jan 2003 16:15:59 -0000 1.10
***************
*** 22,25 ****
--- 22,26 ----
import java.sql.SQLException;
import java.util.ArrayList;
+ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
***************
*** 308,318 ****
* Generate the SQL that updates a row by id (and version)
*/
! protected String generateUpdateString() {
! return new Update()
.setTableName( getTableName() )
! .addColumns( getColumnNames() )
.setPrimaryKeyColumnNames( getIdentifierColumnNames() )
! .setVersionColumnName( getVersionColumnName() )
! .toStatementString();
}
--- 309,322 ----
* Generate the SQL that updates a row by id (and version)
*/
! protected String generateUpdateString(boolean[] includeProperty) {
! Update update = new Update()
.setTableName( getTableName() )
! //.addColumns( getColumnNames() )
.setPrimaryKeyColumnNames( getIdentifierColumnNames() )
! .setVersionColumnName( getVersionColumnName() );
! for ( int i=0; i<hydrateSpan; i++ ) {
! if ( includeProperty[i] ) update.addColumns( propertyColumnNames[i] );
! }
! return update.toStatementString();
}
***************
*** 336,340 ****
* Marshall the fields of a persistent instance to a prepared statement
*/
! protected int dehydrate(Serializable id, Object[] fields, PreparedStatement st, SessionImplementor session) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) log.trace("Dehydrating entity: " + getClassName() + '#' + id);
--- 340,344 ----
* Marshall the fields of a persistent instance to a prepared statement
*/
! protected int dehydrate(Serializable id, Object[] fields, boolean[] includeProperty, PreparedStatement st, SessionImplementor session) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) log.trace("Dehydrating entity: " + getClassName() + '#' + id);
***************
*** 342,347 ****
int index = 1;
for (int j=0; j<hydrateSpan; j++) {
! getPropertyTypes()[j].nullSafeSet( st, fields[j], index, session );
! index += propertyColumnSpans[j];
}
--- 346,353 ----
int index = 1;
for (int j=0; j<hydrateSpan; j++) {
! if ( includeProperty[j] ) {
! getPropertyTypes()[j].nullSafeSet( st, fields[j], index, session );
! index += propertyColumnSpans[j];
! }
}
***************
*** 406,409 ****
--- 412,421 ----
}
+ private boolean[] allProperties() {
+ boolean[] result = new boolean[hydrateSpan];
+ Arrays.fill(result, true);
+ return result;
+ }
+
/**
* Persist an object
***************
*** 424,428 ****
// insert was issued (cos of foreign key constraints). Not necessarily the object's current state
! dehydrate(id, fields, statement, session);
session.getBatcher().addToBatch(1);
--- 436,440 ----
// insert was issued (cos of foreign key constraints). Not necessarily the object's current state
! dehydrate(id, fields, allProperties(), statement, session);
session.getBatcher().addToBatch(1);
***************
*** 451,455 ****
try {
! dehydrate(null, fields, statement, session);
statement.executeUpdate();
}
--- 463,467 ----
try {
! dehydrate(null, fields, allProperties(), statement, session);
statement.executeUpdate();
}
***************
*** 541,545 ****
*/
public void update(Serializable id, Object[] fields, int[] dirtyFields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException {
!
if ( log.isTraceEnabled() ) {
log.trace("Updating entity: " + getClassName() + '#' + id);
--- 553,560 ----
*/
public void update(Serializable id, Object[] fields, int[] dirtyFields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException {
! doUpdate(id, fields, getPropertyMutability(), oldVersion, object, sqlUpdate(), session);
! }
!
! protected void doUpdate(Serializable id, Object[] fields, boolean[] includeProperty, Object oldVersion, Object object, String sql, SessionImplementor session) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) {
log.trace("Updating entity: " + getClassName() + '#' + id);
***************
*** 549,554 ****
if (!hasColumns) return;
- //Render the SQL query
- String sql = sqlUpdate();
final PreparedStatement statement;
if ( isVersioned() ) {
--- 564,567 ----
***************
*** 563,567 ****
//Now write the values of fields onto the prepared statement
! int versionParam = dehydrate(id, fields, statement, session);
if ( isVersioned() ) {
--- 576,580 ----
//Now write the values of fields onto the prepared statement
! int versionParam = dehydrate(id, fields, includeProperty, statement, session);
if ( isVersioned() ) {
***************
*** 700,704 ****
insertString = generateInsertString(false);
identityInsertString = isIdentifierAssignedByInsert() ? generateInsertString(true) : null;
! updateString = generateUpdateString();
String lockString = generateLockString();
--- 713,717 ----
insertString = generateInsertString(false);
identityInsertString = isIdentifierAssignedByInsert() ? generateInsertString(true) : null;
! updateString = generateUpdateString( getPropertyMutability() );
String lockString = generateLockString();
|
|
From: <one...@us...> - 2003-01-24 16:16:34
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping
In directory sc8-pr-cvs1:/tmp/cvs-serv13407/sf/hibernate/mapping
Modified Files:
Property.java
Log Message:
added mutable attribute to <property> element
Index: Property.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Property.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Property.java 19 Jan 2003 11:47:07 -0000 1.4
--- Property.java 24 Jan 2003 16:15:57 -0000 1.5
***************
*** 17,20 ****
--- 17,21 ----
private final Value value;
private String cascade;
+ private boolean mutable;
public Type getType() {
***************
*** 30,33 ****
--- 31,38 ----
return name;
}
+ public boolean isMutable() {
+ return mutable;
+ }
+
public boolean isComposite() {
return value instanceof Component;
***************
*** 41,44 ****
--- 46,51 ----
Node cascadeNode = node.getAttributes().getNamedItem("cascade");
cascade = (cascadeNode==null) ? root.getDefaultCascade() : cascadeNode.getNodeValue();
+ Node mutableNode = node.getAttributes().getNamedItem("mutable");
+ mutable = (mutableNode==null) ? true : "true".equals( mutableNode.getNodeValue() );
}
|
|
From: <one...@us...> - 2003-01-24 16:16:30
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl
In directory sc8-pr-cvs1:/tmp/cvs-serv13407/sf/hibernate/impl
Modified Files:
SessionImpl.java
Log Message:
added mutable attribute to <property> element
Index: SessionImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** SessionImpl.java 22 Jan 2003 13:35:18 -0000 1.12
--- SessionImpl.java 24 Jan 2003 16:15:55 -0000 1.13
***************
*** 617,621 ****
}
! TypeFactory.deepCopy(values, types, values);
nullifyTransientReferences(values, types, identityCol, object);
--- 617,621 ----
}
! TypeFactory.deepCopy(values, types, persister.getPropertyMutability(), values);
nullifyTransientReferences(values, types, identityCol, object);
***************
*** 817,821 ****
else {
entry.deletedState = new Object[entry.loadedState.length];
! TypeFactory.deepCopy(entry.loadedState, propTypes, entry.deletedState);
}
--- 817,821 ----
else {
entry.deletedState = new Object[entry.loadedState.length];
! TypeFactory.deepCopy(entry.loadedState, propTypes, persister.getPropertyMutability(), entry.deletedState);
}
***************
*** 1637,1641 ****
}
Type[] types = subclassPersister.getPropertyTypes();
! TypeFactory.deepCopy(values, types, values);
Object version = Versioning.getVersion(values, subclassPersister);
if ( log.isTraceEnabled() ) log.trace("Cached Version: " + version);
--- 1637,1641 ----
}
Type[] types = subclassPersister.getPropertyTypes();
! TypeFactory.deepCopy(values, types, subclassPersister.getPropertyMutability(), values);
Object version = Versioning.getVersion(values, subclassPersister);
if ( log.isTraceEnabled() ) log.trace("Cached Version: " + version);
***************
*** 1695,1699 ****
for ( int i=0; i<hydratedState.length; i++ ) hydratedState[i] = types[i].resolveIdentifier( hydratedState[i], this );
persister.setPropertyValues(object, hydratedState);
! TypeFactory.deepCopy(hydratedState, persister.getPropertyTypes(), hydratedState); //after setting values to object
if ( persister.hasCache() )
--- 1695,1699 ----
for ( int i=0; i<hydratedState.length; i++ ) hydratedState[i] = types[i].resolveIdentifier( hydratedState[i], this );
persister.setPropertyValues(object, hydratedState);
! TypeFactory.deepCopy(hydratedState, persister.getPropertyTypes(), persister.getPropertyMutability(), hydratedState); //after setting values to object
if ( persister.hasCache() )
***************
*** 1917,1921 ****
Object[] copiedValues = new Object[values.length];
! TypeFactory.deepCopy(values, types, copiedValues);
entry.loadedState = copiedValues; // for next time
entry.nextLockMode = LockMode.WRITE; // if this flush goes ahead, we will have a write lock
--- 1917,1921 ----
Object[] copiedValues = new Object[values.length];
! TypeFactory.deepCopy(values, types, persister.getPropertyMutability(), copiedValues);
entry.loadedState = copiedValues; // for next time
entry.nextLockMode = LockMode.WRITE; // if this flush goes ahead, we will have a write lock
|
|
From: <one...@us...> - 2003-01-24 16:16:28
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate
In directory sc8-pr-cvs1:/tmp/cvs-serv13407/sf/hibernate
Modified Files:
hibernate-mapping-2.0.dtd
Log Message:
added mutable attribute to <property> element
Index: hibernate-mapping-2.0.dtd
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-2.0.dtd,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** hibernate-mapping-2.0.dtd 24 Jan 2003 13:07:16 -0000 1.10
--- hibernate-mapping-2.0.dtd 24 Jan 2003 16:15:54 -0000 1.11
***************
*** 119,122 ****
--- 119,123 ----
<!ATTLIST property not-null (true|false) "false">
<!ATTLIST property unique (true|false) "false">
+ <!ATTLIST property mutable (true|false) "true"> <!-- only supported for properties of a class -->
<!-- Declares an association between two entities (Or from a component, component element,
|
|
From: <one...@us...> - 2003-01-24 13:44:19
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools
In directory sc8-pr-cvs1:/tmp/cvs-serv3970
Modified Files:
SchemaUpdater.java
Log Message:
applied Michael Locher's patch to allow SchemaUpdate to configure Dialect correctly
Index: SchemaUpdater.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/SchemaUpdater.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SchemaUpdater.java 14 Dec 2002 09:27:56 -0000 1.3
--- SchemaUpdater.java 24 Jan 2003 13:44:16 -0000 1.4
***************
*** 29,35 ****
--- 29,37 ----
private ConnectionProvider cp;
Datastore store;
+ Dialect dialect;
public SchemaUpdater(Datastore store) throws HibernateException, SQLException {
this.store = store;
+ dialect = Dialect.getDialect();
cp = ConnectionProviderFactory.newConnectionProvider();
***************
*** 38,41 ****
--- 40,44 ----
public SchemaUpdater(Datastore store, Properties connectionProperties) throws HibernateException {
this.store = store;
+ dialect = Dialect.getDialect(connectionProperties);
cp = ConnectionProviderFactory.newConnectionProvider(connectionProperties);
}
***************
*** 79,83 ****
public void execute(boolean script) throws SQLException, HibernateException {
! Dialect dialect = Dialect.getDialect();
Connection connection = cp.getConnection();
JdbcDatabaseInfo info = new JdbcDatabaseInfo(connection, dialect);
--- 82,86 ----
public void execute(boolean script) throws SQLException, HibernateException {
!
Connection connection = cp.getConnection();
JdbcDatabaseInfo info = new JdbcDatabaseInfo(connection, dialect);
|
|
From: <one...@us...> - 2003-01-24 13:38:40
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl
In directory sc8-pr-cvs1:/tmp/cvs-serv32375
Modified Files:
SchemaUpdate.java
Log Message:
applied Michael Locher's patch to allow SchemaUpdate to configure Dialect correctly
Index: SchemaUpdate.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl/SchemaUpdate.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SchemaUpdate.java 5 Jan 2003 02:11:24 -0000 1.3
--- SchemaUpdate.java 24 Jan 2003 13:38:36 -0000 1.4
***************
*** 23,51 ****
* (C) 2002 Christoph Sturm
*/
! public class SchemaUpdate{
!
Log log = LogFactory.getLog( getClass() );
private ConnectionProvider cp;
Datastore store;
!
public SchemaUpdate(Datastore store) throws HibernateException, SQLException {
this.store = store;
cp = ConnectionProviderFactory.newConnectionProvider();
-
}
!
public SchemaUpdate(Datastore store, Properties connectionProperties) throws HibernateException {
this.store = store;
cp = ConnectionProviderFactory.newConnectionProvider(connectionProperties);
}
!
public static void main(String[] args) {
try {
!
Datastore ds = Hibernate.createDatastore();
!
boolean script = true;
String propFile = null;
!
for ( int i=0; i<args.length; i++ ) {
if( args[i].startsWith("--") ) {
--- 23,53 ----
* (C) 2002 Christoph Sturm
*/
! public class SchemaUpdate {
!
Log log = LogFactory.getLog( getClass() );
private ConnectionProvider cp;
Datastore store;
! Dialect dialect;
!
public SchemaUpdate(Datastore store) throws HibernateException, SQLException {
this.store = store;
+ dialect = Dialect.getDialect();
cp = ConnectionProviderFactory.newConnectionProvider();
}
!
public SchemaUpdate(Datastore store, Properties connectionProperties) throws HibernateException {
this.store = store;
+ dialect = Dialect.getDialect(connectionProperties);
cp = ConnectionProviderFactory.newConnectionProvider(connectionProperties);
}
!
public static void main(String[] args) {
try {
!
Datastore ds = Hibernate.createDatastore();
!
boolean script = true;
String propFile = null;
!
for ( int i=0; i<args.length; i++ ) {
if( args[i].startsWith("--") ) {
***************
*** 60,64 ****
ds.storeFile(args[i]);
}
!
}
if(propFile!=null) {
--- 62,66 ----
ds.storeFile(args[i]);
}
!
}
if(propFile!=null) {
***************
*** 76,97 ****
}
}
!
public void execute(boolean script) throws SQLException, HibernateException {
- Dialect dialect = Dialect.getDialect();
Connection connection = cp.getConnection();
JdbcDatabaseInfo info = new JdbcDatabaseInfo(connection, dialect);
Statement stmt;
stmt = connection.createStatement();
!
boolean jdbc2 = false;
!
String[] createSQL;
createSQL = store.generateSchemaUpdateScript(dialect, info);
for (int j = 0; j < createSQL.length; j++) {
!
final String sql = createSQL[j];
try {
if (script) System.out.println( createSQL[j] );
!
if (jdbc2) {
stmt.addBatch( sql );
--- 78,98 ----
}
}
!
public void execute(boolean script) throws SQLException, HibernateException {
Connection connection = cp.getConnection();
JdbcDatabaseInfo info = new JdbcDatabaseInfo(connection, dialect);
Statement stmt;
stmt = connection.createStatement();
!
boolean jdbc2 = false;
!
String[] createSQL;
createSQL = store.generateSchemaUpdateScript(dialect, info);
for (int j = 0; j < createSQL.length; j++) {
!
final String sql = createSQL[j];
try {
if (script) System.out.println( createSQL[j] );
!
if (jdbc2) {
stmt.addBatch( sql );
***************
*** 100,104 ****
stmt.executeUpdate( sql );
}
!
}
catch (SQLException e) {
--- 101,105 ----
stmt.executeUpdate( sql );
}
!
}
catch (SQLException e) {
***************
*** 106,110 ****
}
}
!
if (jdbc2) stmt.executeBatch();
stmt.close();
--- 107,111 ----
}
}
!
if (jdbc2) stmt.executeBatch();
stmt.close();
|
|
From: <one...@us...> - 2003-01-24 13:30:23
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2java
In directory sc8-pr-cvs1:/tmp/cvs-serv25732
Modified Files:
BasicRenderer.java ClassMapping.java
Log Message:
applied Max Andersen's patch, fixing field scope meta stuff
Index: BasicRenderer.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2java/BasicRenderer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** BasicRenderer.java 20 Jan 2003 12:48:16 -0000 1.5
--- BasicRenderer.java 24 Jan 2003 13:30:19 -0000 1.6
***************
*** 122,126 ****
Field field = (Field) fields.next();
! String fieldScope = getFieldScope(field, "property-scope", "scope-field");
writer.println(
" /** " +
--- 122,126 ----
Field field = (Field) fields.next();
! String fieldScope = getFieldScope(field, "scope-field");
writer.println(
" /** " +
***************
*** 278,282 ****
// getter
! String getAccessScope = getFieldScope(field, "scope", "scope-get");
String getterType = ( field.getType().toLowerCase().equals("boolean") ) ? " is" : " get";
--- 278,282 ----
// getter
! String getAccessScope = getFieldScope(field, "scope-get");
String getterType = ( field.getType().toLowerCase().equals("boolean") ) ? " is" : " get";
***************
*** 290,294 ****
// setter
! String setAccessScope = getFieldScope(field, "scope", "scope-set");
writer.println(" " + setAccessScope + " void set" + field.getAsSuffix() + StringHelper.OPEN_PAREN + getTrueTypeName(field, class2classmap) + " " + field.getName() + ") {");
writer.println(" this." + field.getName() + " = " + field.getName() + ";");
--- 290,294 ----
// setter
! String setAccessScope = getFieldScope(field, "scope-set");
writer.println(" " + setAccessScope + " void set" + field.getAsSuffix() + StringHelper.OPEN_PAREN + getTrueTypeName(field, class2classmap) + " " + field.getName() + ") {");
writer.println(" this." + field.getName() + " = " + field.getName() + ";");
***************
*** 349,359 ****
}
! public String getFieldScope(Field field, String defaultScopeName, String localScopeName) {
! String defaultScope = ( field.getMeta(defaultScopeName)==null )? "public" : field.getMetaAsString(defaultScopeName);
! String fieldScope = defaultScope;
! if (field.getMeta(localScopeName) != null) {
! fieldScope = field.getMetaAsString(localScopeName);
! }
! return fieldScope;
}
--- 349,354 ----
}
! public String getFieldScope(Field field, String localScopeName) {
! return ( field.getMeta(localScopeName)==null )? "private" : field.getMetaAsString(localScopeName);
}
Index: ClassMapping.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2java/ClassMapping.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ClassMapping.java 20 Jan 2003 12:48:16 -0000 1.7
--- ClassMapping.java 24 Jan 2003 13:30:19 -0000 1.8
***************
*** 138,143 ****
else {
//Composite id class
! ClassMapping mapping = new ClassMapping(cmpid, true, inheritedMeta);
! MultiMap metaForCompositeid = MetaAttributeHelper.loadAndMergeMetaMap(cmpid, inheritedMeta);
mapping.implementEquals();
ClassName classType = new ClassName();
--- 138,143 ----
else {
//Composite id class
! ClassMapping mapping = new ClassMapping(cmpid, true, metaattribs);
! MultiMap metaForCompositeid = MetaAttributeHelper.loadAndMergeMetaMap(cmpid, metaattribs);
mapping.implementEquals();
ClassName classType = new ClassName();
***************
*** 155,159 ****
Element property = (Element) properties.next();
! MultiMap metaForProperty = MetaAttributeHelper.loadAndMergeMetaMap(property, inheritedMeta);
String name = property.getAttributeValue("name");
if ( name == null || name.trim().equals(StringHelper.EMPTY_STRING) ) {
--- 155,159 ----
Element property = (Element) properties.next();
! MultiMap metaForProperty = MetaAttributeHelper.loadAndMergeMetaMap(property, metaattribs);
String name = property.getAttributeValue("name");
if ( name == null || name.trim().equals(StringHelper.EMPTY_STRING) ) {
***************
*** 210,214 ****
Element onetoone = (Element) onetoones.next();
! MultiMap metaForOneToOne = MetaAttributeHelper.loadAndMergeMetaMap(onetoone,inheritedMeta);
String name = onetoone.getAttributeValue("name");
--- 210,214 ----
Element onetoone = (Element) onetoones.next();
! MultiMap metaForOneToOne = MetaAttributeHelper.loadAndMergeMetaMap(onetoone,metaattribs);
String name = onetoone.getAttributeValue("name");
***************
*** 228,232 ****
Element manyToOne = (Element) manytoOnes.next();
! MultiMap metaForManyToOne = MetaAttributeHelper.loadAndMergeMetaMap(manyToOne,inheritedMeta);
String name = manyToOne.getAttributeValue("name");
--- 228,232 ----
Element manyToOne = (Element) manytoOnes.next();
! MultiMap metaForManyToOne = MetaAttributeHelper.loadAndMergeMetaMap(manyToOne,metaattribs);
String name = manyToOne.getAttributeValue("name");
***************
*** 252,261 ****
// collections
! doCollections(classElement, "list", "java.util.List", "java.util.ArrayList", inheritedMeta);
! doCollections(classElement, "map", "java.util.Map", "java.util.HashMap", inheritedMeta);
! doCollections(classElement, "set", "java.util.Set", "java.util.HashSet", inheritedMeta);
! doCollections(classElement, "bag", "java.util.Collection", "java.util.ArrayList", inheritedMeta);
! doArrays(classElement, "array", inheritedMeta);
! doArrays(classElement, "primitive-array", inheritedMeta);
--- 252,261 ----
// collections
! doCollections(classElement, "list", "java.util.List", "java.util.ArrayList", metaattribs);
! doCollections(classElement, "map", "java.util.Map", "java.util.HashMap", metaattribs);
! doCollections(classElement, "set", "java.util.Set", "java.util.HashSet", metaattribs);
! doCollections(classElement, "bag", "java.util.Collection", "java.util.ArrayList", metaattribs);
! doArrays(classElement, "array", metaattribs);
! doArrays(classElement, "primitive-array", metaattribs);
***************
*** 266,270 ****
for ( Iterator iter = classElement.getChildren("component").iterator(); iter.hasNext(); ) {
Element cmpe = (Element) iter.next();
! MultiMap metaForComponent = MetaAttributeHelper.loadAndMergeMetaMap(cmpe, inheritedMeta);
String cmpname = cmpe.getAttributeValue("name");
String cmpclass = cmpe.getAttributeValue("class");
--- 266,270 ----
for ( Iterator iter = classElement.getChildren("component").iterator(); iter.hasNext(); ) {
Element cmpe = (Element) iter.next();
! MultiMap metaForComponent = MetaAttributeHelper.loadAndMergeMetaMap(cmpe, metaattribs);
String cmpname = cmpe.getAttributeValue("name");
String cmpclass = cmpe.getAttributeValue("class");
***************
*** 273,277 ****
continue;
}
! ClassMapping mapping = new ClassMapping(cmpe, true, inheritedMeta);
ClassName classType = new ClassName();
--- 273,277 ----
continue;
}
! ClassMapping mapping = new ClassMapping(cmpe, true, metaattribs);
ClassName classType = new ClassName();
***************
*** 289,293 ****
for ( Iterator iter = classElement.getChildren("subclass").iterator(); iter.hasNext(); ) {
Element subclass = (Element) iter.next();
! ClassMapping subclassMapping = new ClassMapping(name, this,subclass, inheritedMeta);
subclasses.add(subclassMapping);
}
--- 289,293 ----
for ( Iterator iter = classElement.getChildren("subclass").iterator(); iter.hasNext(); ) {
Element subclass = (Element) iter.next();
! ClassMapping subclassMapping = new ClassMapping(name, this,subclass, metaattribs);
subclasses.add(subclassMapping);
}
***************
*** 295,299 ****
for ( Iterator iter = classElement.getChildren("joined-subclass").iterator(); iter.hasNext(); ) {
Element subclass = (Element) iter.next();
! ClassMapping subclassMapping = new ClassMapping(name, this, subclass, inheritedMeta);
subclasses.add(subclassMapping);
}
--- 295,299 ----
for ( Iterator iter = classElement.getChildren("joined-subclass").iterator(); iter.hasNext(); ) {
Element subclass = (Element) iter.next();
! ClassMapping subclassMapping = new ClassMapping(name, this, subclass, metaattribs);
subclasses.add(subclassMapping);
}
***************
*** 518,522 ****
try {
! ClassMapping mapping = new ClassMapping(compositeElement, true, inheritedMeta);
ClassName classType = new ClassName();
classType.setFullyQualifiedName(compClass);
--- 518,522 ----
try {
! ClassMapping mapping = new ClassMapping(compositeElement, true, metaattribs);
ClassName classType = new ClassName();
classType.setFullyQualifiedName(compClass);
***************
*** 651,654 ****
--- 651,661 ----
}
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return "ClassMapping: " + name.getFullyQualifiedName();
+ }
|
|
From: <one...@us...> - 2003-01-24 13:30:23
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2java/test
In directory sc8-pr-cvs1:/tmp/cvs-serv25732/test
Modified Files:
Test.hbm.xml
Log Message:
applied Max Andersen's patch, fixing field scope meta stuff
Index: Test.hbm.xml
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2java/test/Test.hbm.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Test.hbm.xml 16 Jan 2003 20:52:38 -0000 1.2
--- Test.hbm.xml 24 Jan 2003 13:30:20 -0000 1.3
***************
*** 58,64 ****
<subclass name="codegen.test.User" proxy="codegen.test.IUser">
! <meta attribute="generated-class">codegen.auto.test.AutoUser</meta>
<property name="email"
! type="string"/>
<property name="date"
type="date"/>
--- 58,68 ----
<subclass name="codegen.test.User" proxy="codegen.test.IUser">
! <meta attribute="generated-class">codegen.auto.test.XAutoUser</meta>
! <meta attribute="scope-field">protected</meta>
!
<property name="email"
! type="string">
!
! </property>
<property name="date"
type="date"/>
|
|
From: <one...@us...> - 2003-01-24 13:11:18
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test
In directory sc8-pr-cvs1:/tmp/cvs-serv12960/sf/hibernate/test
Added Files:
TrivialClass.java
Log Message:
fixed bug in generated SQL for loading <joined-subclass>es
--- NEW FILE: TrivialClass.java ---
package net.sf.hibernate.test;
/**
* @author Administrator
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class TrivialClass extends Simple {
}
|
|
From: <one...@us...> - 2003-01-24 13:07:24
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv9385/sf/hibernate/test Modified Files: Multi.hbm.xml MultiTableTest.java Log Message: fixed bug in generated SQL for loading <joined-subclass>es Index: Multi.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Multi.hbm.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Multi.hbm.xml 1 Jan 2003 13:57:11 -0000 1.1.1.1 --- Multi.hbm.xml 24 Jan 2003 13:07:17 -0000 1.2 *************** *** 1,4 **** <?xml version="1.0"?> ! <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd" > <hibernate-mapping> --- 1,4 ---- <?xml version="1.0"?> ! <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > <hibernate-mapping> *************** *** 13,16 **** --- 13,20 ---- <property name="date" column="date_"/> + <joined-subclass name="net.sf.hibernate.test.TrivialClass"> + <key column="tcid"/> + </joined-subclass> + <joined-subclass name="net.sf.hibernate.test.LessSimple" table="leafsubclass"> <key column="id__"/> *************** *** 20,28 **** <many-to-one name="yetanother" column="other3" class="net.sf.hibernate.test.LessSimple"/> <property name="foo"/> ! <set role="set" lazy="false"> <key column="parent"/> <one-to-many class="net.sf.hibernate.test.Simple"/> </set> ! <bag role="bag" lazy="true" table="simple_simple"> <key column="simple1"/> <many-to-many column="simple2" class="net.sf.hibernate.test.Simple"/> --- 24,32 ---- <many-to-one name="yetanother" column="other3" class="net.sf.hibernate.test.LessSimple"/> <property name="foo"/> ! <set name="set" lazy="false"> <key column="parent"/> <one-to-many class="net.sf.hibernate.test.Simple"/> </set> ! <bag name="bag" lazy="true" table="simple_simple"> <key column="simple1"/> <many-to-many column="simple2" class="net.sf.hibernate.test.Simple"/> *************** *** 45,49 **** <key column="sid"/> <property name="amount"/> ! <bag role="children" lazy="true" readonly="true"> <key column="parent"/> <one-to-many class="net.sf.hibernate.test.SubMulti"/> --- 49,53 ---- <key column="sid"/> <property name="amount"/> ! <bag name="children" lazy="true" inverse="true"> <key column="parent"/> <one-to-many class="net.sf.hibernate.test.SubMulti"/> *************** *** 61,70 **** </id> <property name="value"/> ! <list role="list" cascade="all"> <key column="list_po"/> <index column="i"/> <one-to-many class="net.sf.hibernate.test.SubMulti"/> </list> ! <set role="set" readonly="true" cascade="all"> <key column="po"/> <one-to-many class="net.sf.hibernate.test.Multi"/> --- 65,74 ---- </id> <property name="value"/> ! <list name="list" cascade="all"> <key column="list_po"/> <index column="i"/> <one-to-many class="net.sf.hibernate.test.SubMulti"/> </list> ! <set name="set" inverse="true" cascade="all"> <key column="po"/> <one-to-many class="net.sf.hibernate.test.Multi"/> Index: MultiTableTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MultiTableTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MultiTableTest.java 20 Jan 2003 12:48:14 -0000 1.4 --- MultiTableTest.java 24 Jan 2003 13:07:17 -0000 1.5 *************** *** 24,27 **** --- 24,34 ---- public void testQueries() throws Exception { Session s = sessions.openSession(); + s.save( new TrivialClass(), new Long(1) ); + s.flush(); + s.connection().commit(); + s.close(); + s = sessions.openSession(); + TrivialClass tc = (TrivialClass) s.load( TrivialClass.class, new Long(1) ); + s.find("from s in class TrivialClass where s.id = 2"); s.find("select s.count from s in class Simple"); s.find("from s in class LessSimple where s.another.name='name'"); *************** *** 32,35 **** --- 39,45 ---- s.iterate("from s in class LessSimple"); s.iterate("from s in class Simple"); + s.delete(tc); + s.flush(); + s.connection().commit(); s.close(); } |
|
From: <one...@us...> - 2003-01-24 13:07:24
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader
In directory sc8-pr-cvs1:/tmp/cvs-serv9385/sf/hibernate/loader
Modified Files:
EntityLoader.java OneToManyLoader.java OuterJoinLoader.java
Log Message:
fixed bug in generated SQL for loading <joined-subclass>es
Index: EntityLoader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/EntityLoader.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** EntityLoader.java 20 Jan 2003 12:48:12 -0000 1.7
--- EntityLoader.java 24 Jan 2003 13:07:17 -0000 1.8
***************
*** 47,51 ****
selectString( persister, alias, suffixes[joins] )
)
! .setFromClause( persister.fromClauseFragment(alias, true, true) )
.setWhereClause(
new ConditionFragment().setTableAlias(alias)
--- 47,54 ----
selectString( persister, alias, suffixes[joins] )
)
! .setFromClause(
! persister.fromTableFragment(alias) +
! persister.fromJoinFragment(alias, true, true)
! )
.setWhereClause(
new ConditionFragment().setTableAlias(alias)
***************
*** 55,59 ****
.setOuterJoins(
ojf.toFromFragmentString(),
! ojf.toWhereFragmentString()
)
.toStatementString();
--- 58,63 ----
.setOuterJoins(
ojf.toFromFragmentString(),
! ojf.toWhereFragmentString() +
! persister.whereJoinFragment(alias, true, true)
)
.toStatementString();
Index: OneToManyLoader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/OneToManyLoader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** OneToManyLoader.java 20 Jan 2003 12:48:13 -0000 1.6
--- OneToManyLoader.java 24 Jan 2003 13:07:17 -0000 1.7
***************
*** 60,64 ****
selectString( persister, alias, suffixes[joins] )
)
! .setFromClause( persister.fromClauseFragment(alias, true, true) )
.setWhereClause(
new ConditionFragment().setTableAlias(collAlias)
--- 60,67 ----
selectString( persister, alias, suffixes[joins] )
)
! .setFromClause(
! persister.fromTableFragment(alias) +
! persister.fromJoinFragment(alias, true, true)
! )
.setWhereClause(
new ConditionFragment().setTableAlias(collAlias)
***************
*** 68,72 ****
.setOuterJoins(
ojf.toFromFragmentString(),
! ojf.toWhereFragmentString()
);
if ( collPersister.hasOrdering() ) select.setOrderByClause( collPersister.getSQLOrderByString(collAlias) );
--- 71,76 ----
.setOuterJoins(
ojf.toFromFragmentString(),
! ojf.toWhereFragmentString() +
! persister.whereJoinFragment(alias, true, true)
);
if ( collPersister.hasOrdering() ) select.setOrderByClause( collPersister.getSQLOrderByString(collAlias) );
Index: OuterJoinLoader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/OuterJoinLoader.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** OuterJoinLoader.java 24 Jan 2003 10:21:35 -0000 1.10
--- OuterJoinLoader.java 24 Jan 2003 13:07:17 -0000 1.11
***************
*** 220,225 ****
*/
private static final void appendSelectString(StringBuffer buf, Loadable persister, String alias, String suffix) {
! buf.append( persister.identifierSelectClauseFragment(alias, suffix) )
! .append( persister.propertySelectClauseFragment(alias, suffix) );
}
--- 220,225 ----
*/
private static final void appendSelectString(StringBuffer buf, Loadable persister, String alias, String suffix) {
! buf.append( persister.identifierSelectFragment(alias, suffix) )
! .append( persister.propertySelectFragment(alias, suffix) );
}
***************
*** 262,267 ****
);
outerjoin.addJoins(
! oj.subpersister.fromJoinFragment(oj.subalias, false),
! oj.subpersister.whereJoinFragment(oj.subalias, false)
);
--- 262,267 ----
);
outerjoin.addJoins(
! oj.subpersister.fromJoinFragment(oj.subalias, false, true),
! oj.subpersister.whereJoinFragment(oj.subalias, false, true)
);
|
|
From: <one...@us...> - 2003-01-24 13:07:24
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql
In directory sc8-pr-cvs1:/tmp/cvs-serv9385/sf/hibernate/hql
Modified Files:
QueryTranslator.java
Log Message:
fixed bug in generated SQL for loading <joined-subclass>es
Index: QueryTranslator.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hql/QueryTranslator.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** QueryTranslator.java 24 Jan 2003 10:21:34 -0000 1.9
--- QueryTranslator.java 24 Jan 2003 13:07:16 -0000 1.10
***************
*** 454,459 ****
for ( int i=0; i<joins; i++ ) ojsuffixes[i] = Integer.toString(i) + StringHelper.UNDERSCORE;
ojl.setSuffixes(ojsuffixes);
! selectProperties = persister.propertySelectClauseFragment(name, StringHelper.EMPTY_STRING);
! selectIdentifiers = persister.identifierSelectClauseFragment(name, StringHelper.EMPTY_STRING);
outerJoinedProperties = ojl.selectString(associations);
outerjoin = ojl.outerJoins(associations);
--- 454,459 ----
for ( int i=0; i<joins; i++ ) ojsuffixes[i] = Integer.toString(i) + StringHelper.UNDERSCORE;
ojl.setSuffixes(ojsuffixes);
! selectProperties = persister.propertySelectFragment(name, StringHelper.EMPTY_STRING);
! selectIdentifiers = persister.identifierSelectFragment(name, StringHelper.EMPTY_STRING);
outerJoinedProperties = ojl.selectString(associations);
outerjoin = ojl.outerJoins(associations);
***************
*** 527,531 ****
String name = (String) returnTypes.get(k);
String suffix = size==1 ? StringHelper.EMPTY_STRING : Integer.toString(k) + StringHelper.UNDERSCORE;
! buf.append( persisters[k].identifierSelectClauseFragment(name, suffix) );
if ( k!=size-1 ) buf.append(StringHelper.COMMA_SPACE);
}
--- 527,531 ----
String name = (String) returnTypes.get(k);
String suffix = size==1 ? StringHelper.EMPTY_STRING : Integer.toString(k) + StringHelper.UNDERSCORE;
! buf.append( persisters[k].identifierSelectFragment(name, suffix) );
if ( k!=size-1 ) buf.append(StringHelper.COMMA_SPACE);
}
***************
*** 556,560 ****
String suffix = (size==1) ? StringHelper.EMPTY_STRING : Integer.toString(k) + StringHelper.UNDERSCORE;
String name = (String) returnTypes.get(k) ;
! buf.append( persisters[k].propertySelectClauseFragment(name, suffix) );
}
return buf.toString();
--- 556,560 ----
String suffix = (size==1) ? StringHelper.EMPTY_STRING : Integer.toString(k) + StringHelper.UNDERSCORE;
String name = (String) returnTypes.get(k) ;
! buf.append( persisters[k].propertySelectFragment(name, suffix) );
}
return buf.toString();
***************
*** 639,647 ****
String name = (String) iter.next();
Queryable p = getPersisterForName(name);
buf.append(' ')
! .append( p.fromClauseFragment( name, true, returnTypes.contains(name) && !isShallowQuery() ) );
if ( iter.hasNext() || collections.size()!=0 ) buf.append(',');
}
if (outerjoin!=null) buf.append( outerjoin.toFromFragmentString() );
--- 639,651 ----
String name = (String) iter.next();
Queryable p = getPersisterForName(name);
+ boolean includeSubclasses = returnTypes.contains(name) && !isShallowQuery();
buf.append(' ')
! .append( p.fromTableFragment(name) )
! .append( p.fromJoinFragment(name, true, includeSubclasses) );
if ( iter.hasNext() || collections.size()!=0 ) buf.append(',');
}
+ // add any outerjoins required for association fetching
+ // TODO: (need to move inside loop, eventually)
if (outerjoin!=null) buf.append( outerjoin.toFromFragmentString() );
***************
*** 666,669 ****
--- 670,674 ----
// add any outerjoins required for fetching associations
+ // TODO: (need to move inside loop, eventually)
if (outerjoin!=null) inClassWheres.append( outerjoin.toWhereFragmentString() );
|
|
From: <one...@us...> - 2003-01-24 13:07:23
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate
In directory sc8-pr-cvs1:/tmp/cvs-serv9385/sf/hibernate
Modified Files:
hibernate-mapping-2.0.dtd
Log Message:
fixed bug in generated SQL for loading <joined-subclass>es
Index: hibernate-mapping-2.0.dtd
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-2.0.dtd,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** hibernate-mapping-2.0.dtd 22 Jan 2003 13:09:19 -0000 1.9
--- hibernate-mapping-2.0.dtd 24 Jan 2003 13:07:16 -0000 1.10
***************
*** 105,110 ****
)>
<!ATTLIST joined-subclass name CDATA #REQUIRED>
! <!ATTLIST joined-subclass proxy CDATA #IMPLIED> <!-- default: no proxy interface -->
! <!ATTLIST joined-subclass table CDATA #REQUIRED>
<!ATTLIST joined-subclass schema CDATA #IMPLIED>
--- 105,110 ----
)>
<!ATTLIST joined-subclass name CDATA #REQUIRED>
! <!ATTLIST joined-subclass proxy CDATA #IMPLIED> <!-- default: no proxy interface -->
! <!ATTLIST joined-subclass table CDATA #IMPLIED> <!-- default: unqualified class name -->
<!ATTLIST joined-subclass schema CDATA #IMPLIED>
|
|
From: <one...@us...> - 2003-01-24 13:07:23
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping
In directory sc8-pr-cvs1:/tmp/cvs-serv9385/sf/hibernate/mapping
Modified Files:
RootClass.java Subclass.java
Log Message:
fixed bug in generated SQL for loading <joined-subclass>es
Index: RootClass.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/RootClass.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** RootClass.java 22 Jan 2003 13:09:19 -0000 1.7
--- RootClass.java 24 Jan 2003 13:07:17 -0000 1.8
***************
*** 89,94 ****
Node tableNameNode = atts.getNamedItem("table");
String tableName = (tableNameNode==null) ?
! StringHelper.unqualify( getPersistentClass().getName() ) :
! tableNameNode.getNodeValue();
Node schemaNode = atts.getNamedItem("schema");
--- 89,94 ----
Node tableNameNode = atts.getNamedItem("table");
String tableName = (tableNameNode==null) ?
! StringHelper.unqualify( getPersistentClass().getName() ) :
! tableNameNode.getNodeValue();
Node schemaNode = atts.getNamedItem("schema");
Index: Subclass.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Subclass.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Subclass.java 20 Jan 2003 12:48:13 -0000 1.6
--- Subclass.java 24 Jan 2003 13:07:17 -0000 1.7
***************
*** 90,98 ****
NamedNodeMap atts = node.getAttributes();
! //TABLENAME
! Node tableNameNode = atts.getNamedItem("table");
// TODO: split this class into 2 different subclasses
// one for joined, one for "normal" (same table)
! if (tableNameNode==null) {
//ordinary subclasses
--- 90,97 ----
NamedNodeMap atts = node.getAttributes();
! String mappingStyle = node.getNodeName();
// TODO: split this class into 2 different subclasses
// one for joined, one for "normal" (same table)
! if ( "subclass".equals(mappingStyle) ) {
//ordinary subclasses
***************
*** 105,108 ****
--- 104,109 ----
else {
+ Node tableNameNode = atts.getNamedItem("table");
+
if ( getPersister()==null ) {
getRootClass().setPersister(NormalizedEntityPersister.class);
***************
*** 110,114 ****
// joined subclasses
! String tableName = tableNameNode.getNodeValue();
Node schemaNode = atts.getNamedItem("schema");
String schema = schemaNode==null ? root.getSchemaName() : schemaNode.getNodeValue();
--- 111,117 ----
// joined subclasses
! String tableName = (tableNameNode==null) ?
! StringHelper.unqualify( getPersistentClass().getName() ) :
! tableNameNode.getNodeValue();
Node schemaNode = atts.getNamedItem("schema");
String schema = schemaNode==null ? root.getSchemaName() : schemaNode.getNodeValue();
|