HHH-8686 FumTest hangs on mysql55

This commit is contained in:
Brett Meyer 2013-11-18 18:27:37 -05:00
parent f96eabc08e
commit 328564e038
7 changed files with 4 additions and 44 deletions

View File

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

View File

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

View File

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

View File

@ -1,14 +1,10 @@
//$Id: FumCompositeID.java 4599 2004-09-26 05:18:27Z oneovthafew $
package org.hibernate.test.legacy;
import java.util.Calendar;
public class FumCompositeID implements java.io.Serializable {
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_;
public boolean equals(Object other) {
FumCompositeID that = (FumCompositeID) other;
@ -23,12 +19,6 @@ public class FumCompositeID implements java.io.Serializable {
public void setString(String string_) {
this.string_ = string_;
}
public Calendar getDate() {
return date_;
}
public void setDate(Calendar date_) {
this.date_ = date_;
}
public short getShort() {
return short_;
}

View File

@ -16,7 +16,6 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
@ -310,18 +309,6 @@ public class FumTest extends LegacyTestCase {
private static FumCompositeID fumKey(String str, boolean aCompositeQueryTest) {
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 );
if (aCompositeQueryTest) {
@ -434,40 +421,33 @@ public class FumTest extends LegacyTestCase {
fum = (Fum)vList.get(0);
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 = ?" )
.setParameter( 0, new Short(fiShort), StandardBasicTypes.SHORT )
.list();
assertEquals( "find by composite key query (find fi object)", 1, vList.size() );
fi = (Fum)vList.get(0);
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.close();
s = openSession();
s.beginTransaction();
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(
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();
assertTrue(types.length==4);
assertTrue(types.length==3);
for ( int k=0; k<types.length; k++) {
assertTrue( types[k]!=null );
}
assertTrue(types[0] instanceof StringType);
assertTrue(types[1] instanceof EntityType);
assertTrue(types[2] instanceof StringType);
assertTrue(types[3] instanceof CalendarType);
Iterator iter = qu.iterate();
int j = 0;
while ( iter.hasNext() ) {

View File

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

View File

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