Hibernate SVN: r16382 - in entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test: xml and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 10:01:06 -0400 (Tue, 21 Apr 2009)
New Revision: 16382
Added:
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Address.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Article.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Employee.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Light.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Lighter.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/XmlAttributeOverrideTest.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/XmlTest.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm.xml
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm2.xml
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm3.xml
Modified:
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/cascade/Author.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/cascade/Song.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/orm.xml
Log:
JBPAPP-1078 EJB-413 - Removed a dependency on sequences for XMLTests and added a specific package with sequences, to be used only on databases which supports it. For branch v3_4_0_GA_CP
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/cascade/Author.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/cascade/Author.java 2009-04-21 13:45:48 UTC (rev 16381)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/cascade/Author.java 2009-04-21 14:01:06 UTC (rev 16382)
@@ -2,18 +2,15 @@
package org.hibernate.ejb.test.cascade;
import javax.persistence.Entity;
-import javax.persistence.Id;
import javax.persistence.GeneratedValue;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.GenerationType;
+import javax.persistence.Id;
/**
* @author Emmanuel Bernard
*/
@Entity
public class Author {
- @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ENTITY2_SEQ")
- @SequenceGenerator(name = "ENTITY2_SEQ")
+ @Id @GeneratedValue
private Long id;
}
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/cascade/Song.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/cascade/Song.java 2009-04-21 13:45:48 UTC (rev 16381)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/cascade/Song.java 2009-04-21 14:01:06 UTC (rev 16382)
@@ -2,20 +2,18 @@
package org.hibernate.ejb.test.cascade;
import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.GeneratedValue;
import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
import javax.persistence.ManyToOne;
-import javax.persistence.GenerationType;
-import javax.persistence.SequenceGenerator;
/**
* @author Emmanuel Bernard
*/
@Entity
public class Song {
- @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ENTITY1_SEQ")
- @SequenceGenerator(name = "ENTITY1_SEQ") private Long id;
+ @Id @GeneratedValue
+ private Long id;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private Author author;
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/orm.xml
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/orm.xml 2009-04-21 13:45:48 UTC (rev 16381)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/orm.xml 2009-04-21 14:01:06 UTC (rev 16382)
@@ -26,7 +26,7 @@
metadata-complete="false">
<attributes>
<id name="id">
- <generated-value strategy="SEQUENCE"/>
+ <generated-value strategy="AUTO"/>
</id>
</attributes>
</entity>
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Address.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Address.java (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Address.java 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,54 @@
+//$Id: $
+package org.hibernate.ejb.test.xml.sequences;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Address {
+ private String street;
+ private String city;
+ private String state;
+ private String zip;
+
+ public Address() {
+ }
+
+ public Address(String street, String city, String state, String zip) {
+ this.street = street;
+ this.city = city;
+ this.state = state;
+ this.zip = zip;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getZip() {
+ return zip;
+ }
+
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+}
\ No newline at end of file
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Article.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Article.java (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Article.java 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,49 @@
+//$Id: $
+package org.hibernate.ejb.test.xml.sequences;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.GeneratedValue;
+import javax.persistence.CascadeType;
+import javax.persistence.ManyToOne;
+import javax.persistence.JoinColumn;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+@Table(name = "ITEM")
+(a)org.hibernate.annotations.BatchSize(size = 10)
+public class Article {
+ private Integer id;
+ private String name;
+
+ private Article nextArticle;
+
+ @Id @GeneratedValue public Integer getId() {
+ return id;
+ }
+ public void setId(Integer id) {
+ this.id = id;
+ }
+ @Column(name="poopoo")
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "NEXT_MESSAGE_ID")
+ public Article getNextArticle() {
+ return nextArticle;
+ }
+
+ public void setNextArticle(Article nextArticle) {
+ this.nextArticle = nextArticle;
+ }
+}
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Employee.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Employee.java (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Employee.java 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,66 @@
+//$Id: $
+package org.hibernate.ejb.test.xml.sequences;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class Employee {
+ @Id
+ Long id;
+ String name;
+/*
+ @Embedded
+ @AttributeOverrides({
+ @AttributeOverride(name = "street", column = @Column(name = "HA_street")),
+ @AttributeOverride(name = "city", column = @Column(name = "HA_city")),
+ @AttributeOverride(name = "state", column = @Column(name = "HA_state")),
+ @AttributeOverride(name = "zip", column = @Column(name = "HA_zip")) })
+*/
+ Address homeAddress;
+
+/*
+ @Embedded
+ @AttributeOverrides({
+ @AttributeOverride(name = "street", column = @Column(name = "MA_street")),
+ @AttributeOverride(name = "city", column = @Column(name = "MA_city")),
+ @AttributeOverride(name = "state", column = @Column(name = "MA_state")),
+ @AttributeOverride(name = "zip", column = @Column(name = "MA_zip")) })
+*/
+ Address mailAddress;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Address getHomeAddress() {
+ return homeAddress;
+ }
+
+ public void setHomeAddress(Address homeAddress) {
+ this.homeAddress = homeAddress;
+ }
+
+ public Address getMailAddress() {
+ return mailAddress;
+ }
+
+ public void setMailAddress(Address mailAddress) {
+ this.mailAddress = mailAddress;
+ }
+}
\ No newline at end of file
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Light.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Light.java (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Light.java 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,10 @@
+//$Id: $
+package org.hibernate.ejb.test.xml.sequences;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Light {
+ public String name;
+ public String power;
+}
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Lighter.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Lighter.java (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Lighter.java 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,10 @@
+//$Id: $
+package org.hibernate.ejb.test.xml.sequences;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Lighter {
+ public String name;
+ public String power;
+}
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/XmlAttributeOverrideTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/XmlAttributeOverrideTest.java (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/XmlAttributeOverrideTest.java 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,41 @@
+//$Id: $
+package org.hibernate.ejb.test.xml.sequences;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.ejb.test.TestCase;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class XmlAttributeOverrideTest extends TestCase {
+
+ public void testAttributeOverriding() throws Exception {
+ EntityManager em = getOrCreateEntityManager();
+ em.getTransaction().begin();
+
+ Employee e = new Employee();
+ e.setId(Long.valueOf(100));
+ e.setName("Bubba");
+ e.setHomeAddress(new Address("123 Main St", "New York", "NY", "11111"));
+ e.setMailAddress(new Address("P.O. Box 123", "New York", "NY", "11111"));
+
+ em.persist(e);
+
+ em.flush();
+
+ em.getTransaction().rollback();
+ em.close();
+ }
+
+ public Class[] getAnnotatedClasses() {
+ return new Class[0];
+ }
+
+ @Override
+ public String[] getEjb3DD() {
+ return new String[] {
+ "org/hibernate/ejb/test/xml/sequences/orm3.xml"
+ };
+ }
+}
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/XmlTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/XmlTest.java (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/XmlTest.java 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,34 @@
+//$Id: $
+package org.hibernate.ejb.test.xml.sequences;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.dialect.Dialect;
+import org.hibernate.ejb.test.TestCase;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class XmlTest extends TestCase {
+ public void testXmlMappingCorrectness() throws Exception {
+ EntityManager em = getOrCreateEntityManager();
+ em.close();
+ }
+
+ public Class[] getAnnotatedClasses() {
+ return new Class[0];
+ }
+
+ @Override
+ public boolean appliesTo(Dialect dialect) {
+ return dialect.supportsSequences();
+ }
+
+ @Override
+ public String[] getEjb3DD() {
+ return new String[] {
+ "org/hibernate/ejb/test/xml/sequences/orm.xml",
+ "org/hibernate/ejb/test/xml/sequences/orm2.xml",
+ };
+ }
+}
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm.xml
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm.xml (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm.xml 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
+ version="1.0"
+ >
+ <persistence-unit-metadata>
+ <persistence-unit-defaults>
+ <schema>MY_SCHEMA</schema>
+ <catalog>MY_CATALOG</catalog>
+ <access>PROPERTY</access>
+ <cascade-persist/>
+ </persistence-unit-defaults>
+ </persistence-unit-metadata>
+ <package>org.hibernate.ejb.test.xml.sequences</package>
+ <entity class="Light" metadata-complete="true" access="FIELD">
+ <attributes>
+ <id name="name">
+ <column name="fld_id"/>
+ </id>
+ <basic name="power"></basic>
+ </attributes>
+ </entity>
+ <entity class="Article"
+ metadata-complete="false">
+ <attributes>
+ <id name="id">
+ <generated-value strategy="SEQUENCE"/>
+ </id>
+ </attributes>
+ </entity>
+</entity-mappings>
\ No newline at end of file
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm2.xml
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm2.xml (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm2.xml 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
+ version="1.0"
+ >
+ <entity class="org.hibernate.ejb.test.xml.sequences.Lighter" name="ALighter" access="FIELD" metadata-complete="true">
+ <attributes>
+ <id name="name">
+ <column name="fld_id"/>
+ </id>
+ <basic name="power"></basic>
+ </attributes>
+ </entity>
+ <!-- entity class="NoPackageEntity" name="ALighter" access="FIELD" metadata-complete="true">
+ <attributes>
+ <id name="id"/>
+ <basic name="name"/>
+ </attributes>
+ </entity -->
+ <embeddable class="NoPackageEntity" access="FIELD">
+ <attributes>
+ <basic name="name"/>
+ </attributes>
+ </embeddable>
+</entity-mappings>
\ No newline at end of file
Added: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm3.xml
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm3.xml (rev 0)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/orm3.xml 2009-04-21 14:01:06 UTC (rev 16382)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
+ version="1.0">
+
+ <entity class="org.hibernate.ejb.test.xml.sequences.Employee" metadata-complete="false" access="FIELD">
+ <attributes>
+ <id name="id"/>
+ <basic name="name"/>
+
+ <embedded name="homeAddress">
+ <attribute-override name="street">
+ <column name="home_street"/>
+ </attribute-override>
+ <attribute-override name="city">
+ <column name="home_city"/>
+ </attribute-override>
+ <attribute-override name="state">
+ <column name="home_state"/>
+ </attribute-override>
+ <attribute-override name="zip">
+ <column name="home_zip"/>
+ </attribute-override>
+ </embedded>
+
+ <embedded name="mailAddress">
+ <attribute-override name="street">
+ <column name="mail_street"/>
+ </attribute-override>
+ <attribute-override name="city">
+ <column name="mail_city"/>
+ </attribute-override>
+ <attribute-override name="state">
+ <column name="mail_state"/>
+ </attribute-override>
+ <attribute-override name="zip">
+ <column name="mail_zip"/>
+ </attribute-override>
+ </embedded>
+
+ </attributes>
+ </entity>
+
+ <embeddable class="org.hibernate.ejb.test.xml.sequences.Address">
+ <attributes>
+ <basic name="street"/>
+ <basic name="city"/>
+ <basic name="state"/>
+ <basic name="zip"/>
+ </attributes>
+ </embeddable>
+
+</entity-mappings>
\ No newline at end of file
15 years, 7 months
Hibernate SVN: r16381 - entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 09:45:48 -0400 (Tue, 21 Apr 2009)
New Revision: 16381
Modified:
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java
Log:
EJB-404 - Changed order and added cast to avoid problems with pgsql and db2. For branch v3_4_0_GA_CP
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java 2009-04-21 13:39:04 UTC (rev 16380)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java 2009-04-21 13:45:48 UTC (rev 16381)
@@ -305,7 +305,7 @@
em.flush();
em.clear();
Query q = em.createQuery(
- "select i from Item i where (i.descr is null and :descr is null) or i.descr = :descr"
+ "select i from Item i where i.descr = :descr or (i.descr is null and cast(:descr as string) is null)"
);
//Query q = em.createQuery( "select i from Item i where (i.descr is null and :descr is null) or (i.descr = :descr");
q.setParameter( "descr", "dd" );
15 years, 7 months
Hibernate SVN: r16380 - core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 09:39:04 -0400 (Tue, 21 Apr 2009)
New Revision: 16380
Modified:
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/QueryTest.java
Log:
EJB-403 - Removed alias from native update statement, as it is not supported in many databases. For trunk
Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/QueryTest.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/QueryTest.java 2009-04-21 13:38:33 UTC (rev 16379)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/QueryTest.java 2009-04-21 13:39:04 UTC (rev 16380)
@@ -334,7 +334,7 @@
assertEquals(
1, em.createNativeQuery(
- "update Item i set i.descr = 'Logitech Mouse' where i.name = 'Mouse'"
+ "update Item set descr = 'Logitech Mouse' where name = 'Mouse'"
).executeUpdate()
);
item = em.find( Item.class, item.getName() );
15 years, 7 months
Hibernate SVN: r16379 - entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 09:38:33 -0400 (Tue, 21 Apr 2009)
New Revision: 16379
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java
Log:
EJB-403 - Removed alias from native update statement, as it is not supported in many databases. For branch v3_3_2_GA_CP
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java 2009-04-21 13:38:14 UTC (rev 16378)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java 2009-04-21 13:38:33 UTC (rev 16379)
@@ -334,7 +334,7 @@
assertEquals(
1, em.createNativeQuery(
- "update Item i set i.descr = 'Logitech Mouse' where i.name = 'Mouse'"
+ "update Item set descr = 'Logitech Mouse' where name = 'Mouse'"
).executeUpdate()
);
item = em.find( Item.class, item.getName() );
15 years, 7 months
Hibernate SVN: r16378 - entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 09:38:14 -0400 (Tue, 21 Apr 2009)
New Revision: 16378
Modified:
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java
Log:
EJB-403 - Removed alias from native update statement, as it is not supported in many databases. For branch v3_4_0_GA_CP
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java 2009-04-21 13:15:48 UTC (rev 16377)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/QueryTest.java 2009-04-21 13:38:14 UTC (rev 16378)
@@ -334,7 +334,7 @@
assertEquals(
1, em.createNativeQuery(
- "update Item i set i.descr = 'Logitech Mouse' where i.name = 'Mouse'"
+ "update Item set descr = 'Logitech Mouse' where name = 'Mouse'"
).executeUpdate()
);
item = em.find( Item.class, item.getName() );
15 years, 7 months
Hibernate SVN: r16377 - core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 09:15:48 -0400 (Tue, 21 Apr 2009)
New Revision: 16377
Modified:
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/EJB3TestCase.java
Log:
EJB-418 - Added tearDown method to EJB3TestCase, as the current behaviour was keeping some dirt in the database after the execution of the last test in the EJB3TestCase hierarquy. For trunk
Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/EJB3TestCase.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21 13:15:14 UTC (rev 16376)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21 13:15:48 UTC (rev 16377)
@@ -113,11 +113,17 @@
}
protected void setUp() throws Exception {
- if ( getSessions() == null || lastTestClass != getClass() ) {
+ if ( getSessions() == null || lastTestClass != getClass() || getSessions().isClosed() ) {
buildSessionFactory( getMappings() );
lastTestClass = getClass();
}
}
+
+ protected void tearDown() throws Exception {
+ if (getSessions() != null && !getSessions().isClosed()) {
+ getSessions().close();
+ }
+ }
protected void runTest() throws Throwable {
final boolean stats = ( (SessionFactoryImplementor) sessions ).getStatistics().isStatisticsEnabled();
15 years, 7 months
Hibernate SVN: r16376 - entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 09:15:14 -0400 (Tue, 21 Apr 2009)
New Revision: 16376
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java
Log:
EJB-418 - Added tearDown method to EJB3TestCase, as the current behaviour was keeping some dirt in the database after the execution of the last test in the EJB3TestCase hierarquy. For branch v3_3_2_GA_CP
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21 13:14:49 UTC (rev 16375)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21 13:15:14 UTC (rev 16376)
@@ -113,11 +113,17 @@
}
protected void setUp() throws Exception {
- if ( getSessions() == null || lastTestClass != getClass() ) {
+ if ( getSessions() == null || lastTestClass != getClass() || getSessions().isClosed() ) {
buildSessionFactory( getMappings() );
lastTestClass = getClass();
}
}
+
+ protected void tearDown() throws Exception {
+ if (getSessions() != null && !getSessions().isClosed()) {
+ getSessions().close();
+ }
+ }
protected void runTest() throws Throwable {
final boolean stats = ( (SessionFactoryImplementor) sessions ).getStatistics().isStatisticsEnabled();
15 years, 7 months
Hibernate SVN: r16375 - entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 09:14:49 -0400 (Tue, 21 Apr 2009)
New Revision: 16375
Modified:
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java
Log:
EJB-418 - Added tearDown method to EJB3TestCase, as the current behaviour was keeping some dirt in the database after the execution of the last test in the EJB3TestCase hierarquy. For branch v3_4_0_GA_CP
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21 11:48:01 UTC (rev 16374)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21 13:14:49 UTC (rev 16375)
@@ -113,11 +113,17 @@
}
protected void setUp() throws Exception {
- if ( getSessions() == null || lastTestClass != getClass() ) {
+ if ( getSessions() == null || lastTestClass != getClass() || getSessions().isClosed() ) {
buildSessionFactory( getMappings() );
lastTestClass = getClass();
}
}
+
+ protected void tearDown() throws Exception {
+ if (getSessions() != null && !getSessions().isClosed()) {
+ getSessions().close();
+ }
+ }
protected void runTest() throws Throwable {
final boolean stats = ( (SessionFactoryImplementor) sessions ).getStatistics().isStatisticsEnabled();
15 years, 7 months
Hibernate SVN: r16374 - in entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test: emops and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 07:48:01 -0400 (Tue, 21 Apr 2009)
New Revision: 16374
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/callbacks/CallbacksTest.java
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushTest.java
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/lock/LockTest.java
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java
Log:
EJB-407 - Fixed tests which weren't closing the EM after finishing their work. For branch v3_3_2_GA_CP
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/callbacks/CallbacksTest.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/callbacks/CallbacksTest.java 2009-04-21 11:47:14 UTC (rev 16373)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/callbacks/CallbacksTest.java 2009-04-21 11:48:01 UTC (rev 16374)
@@ -113,6 +113,7 @@
em.flush();
assertNotNull( rc.getCreationDate() );
em.getTransaction().rollback();
+ em.close();
}
public void testCallBackListenersHierarchy() throws Exception {
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushTest.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushTest.java 2009-04-21 11:47:14 UTC (rev 16373)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushTest.java 2009-04-21 11:48:01 UTC (rev 16374)
@@ -66,7 +66,10 @@
for (Decorate value : founds) {
assertTrue( names.contains( value.getPet().getName() ) );
}
+ manager.getTransaction().rollback();
+ manager.close();
+
}
public Dog createDog(String name, double weight, int bones, EntityManager manager) {
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/lock/LockTest.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/lock/LockTest.java 2009-04-21 11:47:14 UTC (rev 16373)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/lock/LockTest.java 2009-04-21 11:48:01 UTC (rev 16374)
@@ -30,6 +30,8 @@
assertEquals( "surname", lock.getName() );
em.remove( lock );
em.getTransaction().commit();
+
+ em.close();
}
public void testLockWrite() throws Exception {
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java 2009-04-21 11:47:14 UTC (rev 16373)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java 2009-04-21 11:48:01 UTC (rev 16374)
@@ -42,6 +42,7 @@
em.getTransaction().begin();
em.remove( em.find( Book.class, book.id ) );
em.getTransaction().commit();
+ em.close();
}
// public void testTransactionalOperationsWhenTransactional() throws Exception {
15 years, 7 months
Hibernate SVN: r16373 - in entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test: emops and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-21 07:47:14 -0400 (Tue, 21 Apr 2009)
New Revision: 16373
Modified:
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/callbacks/CallbacksTest.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushTest.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/exception/ExceptionTest.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/lock/LockTest.java
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java
Log:
EJB-407 - Fixed tests which weren't closing the EM after finishing their work. For branch v3_4_0_GA_CP
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/callbacks/CallbacksTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/callbacks/CallbacksTest.java 2009-04-21 11:29:01 UTC (rev 16372)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/callbacks/CallbacksTest.java 2009-04-21 11:47:14 UTC (rev 16373)
@@ -116,6 +116,7 @@
em.flush();
assertNotNull( rc.getCreationDate() );
em.getTransaction().rollback();
+ em.close();
}
public void testCallBackListenersHierarchy() throws Exception {
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushTest.java 2009-04-21 11:29:01 UTC (rev 16372)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushTest.java 2009-04-21 11:47:14 UTC (rev 16373)
@@ -66,7 +66,10 @@
for (Decorate value : founds) {
assertTrue( names.contains( value.getPet().getName() ) );
}
+ manager.getTransaction().rollback();
+ manager.close();
+
}
public Dog createDog(String name, double weight, int bones, EntityManager manager) {
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/exception/ExceptionTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/exception/ExceptionTest.java 2009-04-21 11:29:01 UTC (rev 16372)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/exception/ExceptionTest.java 2009-04-21 11:47:14 UTC (rev 16373)
@@ -100,6 +100,7 @@
catch( PersistenceException e ) {
Throwable t = e.getCause();
assertTrue("Should be a constraint violation", t instanceof ConstraintViolationException);
+ em.getTransaction().rollback();
}
finally {
em.close();
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/lock/LockTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/lock/LockTest.java 2009-04-21 11:29:01 UTC (rev 16372)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/lock/LockTest.java 2009-04-21 11:47:14 UTC (rev 16373)
@@ -30,6 +30,8 @@
assertEquals( "surname", lock.getName() );
em.remove( lock );
em.getTransaction().commit();
+
+ em.close();
}
public void testLockWrite() throws Exception {
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java 2009-04-21 11:29:01 UTC (rev 16372)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/transaction/FlushAndTransactionTest.java 2009-04-21 11:47:14 UTC (rev 16373)
@@ -42,6 +42,7 @@
em.getTransaction().begin();
em.remove( em.find( Book.class, book.id ) );
em.getTransaction().commit();
+ em.close();
}
// public void testTransactionalOperationsWhenTransactional() throws Exception {
15 years, 7 months