HHH-8686 FumTest hangs on mysql55

This commit is contained in:
Brett Meyer 2013-11-18 18:27:37 -05:00
parent 465c3b1e9c
commit fe6263936e
7 changed files with 4 additions and 45 deletions

View File

@ -10,7 +10,6 @@
<column name="string_" length="20"/> <column name="string_" length="20"/>
</key-property> </key-property>
<key-property name="short" column="short_"/> <key-property name="short" column="short_"/>
<key-property name="date" column="date_" type="calendar"/>
</composite-id> </composite-id>
<version name="version" type="long"/> <version name="version" type="long"/>
<property name="serial" column="serial_"/> <property name="serial" column="serial_"/>

View File

@ -12,7 +12,6 @@
<column name="string_" length="10"/> <column name="string_" length="10"/>
</key-property> </key-property>
<key-property name="short" column="short_"/> <key-property name="short" column="short_"/>
<key-property name="date" column="date_" type="calendar"/>
</composite-id> </composite-id>
<version name="vid" type="short" access="field"/> <version name="vid" type="short" access="field"/>
<!--version name="lastUpdated" type="calendar"/--> <!--version name="lastUpdated" type="calendar"/-->
@ -21,13 +20,11 @@
<many-to-one name="fo"> <many-to-one name="fo">
<column name="fo_string" length="10"/> <column name="fo_string" length="10"/>
<column name="fo_short"/> <column name="fo_short"/>
<column name="fo_date"/>
</many-to-one> </many-to-one>
<set name="friends"> <set name="friends">
<key> <key>
<column name="fr_string_" length="10"/> <column name="fr_string_" length="10"/>
<column name="fr_short_"/> <column name="fr_short_"/>
<column name="fr_date_"/>
</key> </key>
<one-to-many class="org.hibernate.test.legacy.Fum"/> <one-to-many class="org.hibernate.test.legacy.Fum"/>
</set> </set>
@ -35,7 +32,6 @@
<key> <key>
<column name="fum_str_" length="10"/> <column name="fum_str_" length="10"/>
<column name="fum_sho_"/> <column name="fum_sho_"/>
<column name="fum_dat_"/>
</key> </key>
<index column="i"/> <index column="i"/>
<one-to-many class="org.hibernate.test.legacy.Qux"/> <one-to-many class="org.hibernate.test.legacy.Qux"/>
@ -51,7 +47,6 @@
<key> <key>
<column name="fum_str_" length="10"/> <column name="fum_str_" length="10"/>
<column name="fum_sho_"/> <column name="fum_sho_"/>
<column name="fum_dat_"/>
</key> </key>
<index column="fummapindex" type="string"/> <index column="fummapindex" type="string"/>
<one-to-many class="org.hibernate.test.legacy.Fum"/> <one-to-many class="org.hibernate.test.legacy.Fum"/>
@ -60,7 +55,6 @@
<key> <key>
<column name="fum_str_" length="10"/> <column name="fum_str_" length="10"/>
<column name="fum_sho_"/> <column name="fum_sho_"/>
<column name="fum_dat_"/>
</key> </key>
<index column="mapindex" type="string"/> <index column="mapindex" type="string"/>
<element column="mapelement" type="string"/> <element column="mapelement" type="string"/>

View File

@ -31,7 +31,6 @@ public class Fum implements Lifecycle, Serializable {
this.id = id; this.id = id;
friends = new HashSet(); friends = new HashSet();
FumCompositeID fid = new FumCompositeID(); FumCompositeID fid = new FumCompositeID();
fid.setDate( Calendar.getInstance() );
fid.setShort( (short) ( id.short_ + 33 ) ); fid.setShort( (short) ( id.short_ + 33 ) );
fid.setString( id.string_ + "dd" ); fid.setString( id.string_ + "dd" );
Fum f = new Fum(); Fum f = new Fum();

View File

@ -1,14 +1,10 @@
//$Id: FumCompositeID.java 4599 2004-09-26 05:18:27Z oneovthafew $ //$Id: FumCompositeID.java 4599 2004-09-26 05:18:27Z oneovthafew $
package org.hibernate.test.legacy; package org.hibernate.test.legacy;
import java.util.Calendar;
public class FumCompositeID implements java.io.Serializable { public class FumCompositeID implements java.io.Serializable {
String string_; String string_;
// this CANNOT be a Date -- they are forcefully stripped of time, changing the PK
// TODO: having a date/calendar as a PK is horrible...
Calendar date_;
short short_; short short_;
public boolean equals(Object other) { public boolean equals(Object other) {
FumCompositeID that = (FumCompositeID) other; FumCompositeID that = (FumCompositeID) other;
@ -23,12 +19,6 @@ public class FumCompositeID implements java.io.Serializable {
public void setString(String string_) { public void setString(String string_) {
this.string_ = string_; this.string_ = string_;
} }
public Calendar getDate() {
return date_;
}
public void setDate(Calendar date_) {
this.date_ = date_;
}
public short getShort() { public short getShort() {
return short_; return short_;
} }

View File

@ -16,7 +16,6 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
@ -25,7 +24,6 @@ import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.junit.Test;
import org.hibernate.Criteria; import org.hibernate.Criteria;
import org.hibernate.FetchMode; import org.hibernate.FetchMode;
import org.hibernate.FlushMode; import org.hibernate.FlushMode;
@ -312,18 +310,6 @@ public class FumTest extends LegacyTestCase {
private static FumCompositeID fumKey(String str, boolean aCompositeQueryTest) { private static FumCompositeID fumKey(String str, boolean aCompositeQueryTest) {
FumCompositeID id = new FumCompositeID(); FumCompositeID id = new FumCompositeID();
if ( getDialect() instanceof MckoiDialect ) {
GregorianCalendar now = new GregorianCalendar();
GregorianCalendar cal = new GregorianCalendar(
now.get(java.util.Calendar.YEAR),
now.get(java.util.Calendar.MONTH),
now.get(java.util.Calendar.DATE)
);
id.setDate( cal );
}
else {
id.setDate( Calendar.getInstance() );
}
id.setString( str ); id.setString( str );
if (aCompositeQueryTest) { if (aCompositeQueryTest) {
@ -442,40 +428,33 @@ public class FumTest extends LegacyTestCase {
fum = (Fum)vList.get(0); fum = (Fum)vList.get(0);
assertTrue( "find by composite key query (check fo object)", fum.getId().getString().equals("fo") ); assertTrue( "find by composite key query (check fo object)", fum.getId().getString().equals("fo") );
// Try to find the Fum object "fi" that we inserted searching by the date in the id // Try to find the Fum object "fi" that we inserted
vList = s.createQuery( "from Fum fum where fum.id.short = ?" ) vList = s.createQuery( "from Fum fum where fum.id.short = ?" )
.setParameter( 0, new Short(fiShort), StandardBasicTypes.SHORT ) .setParameter( 0, new Short(fiShort), StandardBasicTypes.SHORT )
.list(); .list();
assertEquals( "find by composite key query (find fi object)", 1, vList.size() ); assertEquals( "find by composite key query (find fi object)", 1, vList.size() );
fi = (Fum)vList.get(0); fi = (Fum)vList.get(0);
assertEquals( "find by composite key query (check fi object)", "fi", fi.getId().getString() ); assertEquals( "find by composite key query (check fi object)", "fi", fi.getId().getString() );
// Make sure we can return all of the objects by searching by the date id
vList = s.createQuery( "from Fum fum where fum.id.date <= ? and not fum.fum='FRIEND'" )
.setParameter( 0, Calendar.getInstance(), StandardBasicTypes.CALENDAR )
.list();
assertEquals( "find by composite key query with arguments", 4, vList.size() );
s.getTransaction().commit(); s.getTransaction().commit();
s.close(); s.close();
s = openSession(); s = openSession();
s.beginTransaction(); s.beginTransaction();
assertTrue( assertTrue(
s.createQuery( "select fum.id.short, fum.id.date, fum.id.string from Fum fum" ).iterate().hasNext() s.createQuery( "select fum.id.short, fum.id.string from Fum fum" ).iterate().hasNext()
); );
assertTrue( assertTrue(
s.createQuery( "select fum.id from Fum fum" ).iterate().hasNext() s.createQuery( "select fum.id from Fum fum" ).iterate().hasNext()
); );
Query qu = s.createQuery("select fum.fum, fum , fum.fum, fum.id.date from Fum fum"); Query qu = s.createQuery("select fum.fum, fum , fum.fum from Fum fum");
Type[] types = qu.getReturnTypes(); Type[] types = qu.getReturnTypes();
assertTrue(types.length==4); assertTrue(types.length==3);
for ( int k=0; k<types.length; k++) { for ( int k=0; k<types.length; k++) {
assertTrue( types[k]!=null ); assertTrue( types[k]!=null );
} }
assertTrue(types[0] instanceof StringType); assertTrue(types[0] instanceof StringType);
assertTrue(types[1] instanceof EntityType); assertTrue(types[1] instanceof EntityType);
assertTrue(types[2] instanceof StringType); assertTrue(types[2] instanceof StringType);
assertTrue(types[3] instanceof CalendarType);
Iterator iter = qu.iterate(); Iterator iter = qu.iterate();
int j = 0; int j = 0;
while ( iter.hasNext() ) { while ( iter.hasNext() ) {

View File

@ -10,7 +10,6 @@
<column name="string_" length="10"/> <column name="string_" length="10"/>
</key-property> </key-property>
<key-property name="short" column="short_"/> <key-property name="short" column="short_"/>
<key-property name="date" column="date_" type="calendar"/>
</composite-id> </composite-id>
<property name="locale"/> <property name="locale"/>
<one-to-one name="fum" cascade="all" constrained="true"/> <one-to-one name="fum" cascade="all" constrained="true"/>

View File

@ -22,7 +22,6 @@
<many-to-many class="org.hibernate.test.legacy.Fum"> <many-to-many class="org.hibernate.test.legacy.Fum">
<column name="fum_string" length="10" not-null="true"/> <column name="fum_string" length="10" not-null="true"/>
<column name="fum_short" not-null="true"/> <column name="fum_short" not-null="true"/>
<column name="fum_date" not-null="true"/>
</many-to-many> </many-to-many>
</set> </set>
<list name="moreFums" lazy="true"> <list name="moreFums" lazy="true">