[Hibernate-JIRA] Created: (HBX-975) i have deleted tables fro the database and i m trying to recreate these tables using Hibernate 2.
by sridhar negi (JIRA)
i have deleted tables fro the database and i m trying to recreate these tables using Hibernate 2.
---------------------------------------------------------------------------------------------------
Key: HBX-975
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-975
Project: Hibernate Tools
Issue Type: Bug
Environment: Hibernate 2 & oracle 9i
Reporter: sridhar negi
i have deleted tables from the database and i m trying to recreate these tables using Hibernate 2. but i m unable to do the same .It tries to alter a table which is not present in the database. it seems that hibernate is referring some other database schema. I m getting an error some thing like this..
[java] alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 52085 DEBUG [main] hbm2ddl.SchemaUpdate - execute alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 52147 ERROR [main] hbm2ddl.SchemaUpdate - execute Unsuccessful: alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 52147 ERROR [main] hbm2ddl.SchemaUpdate - execute ORA-00942: table or view does not exist.
How to handle this situation. Do i have to go for Hibernate 3, or is there any other solution to the problem? If at alll i have to use hibernate 3 what are the changes do i have to make in the project make it work for me.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1312) Unclosed ResultSet when using Identity
by Christian Gruber (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1312?page=c... ]
Christian Gruber commented on HHH-1312:
---------------------------------------
Hi!
I'd also vote for closing the ResultSet, since
- hygiene is never a bad thing ;-)
- for bulk inserts with MySQL, this is a big memory leak
When I alter IdentityGenerator.GetGeneratedKeysDelegate.executeAndExtract() so that the ResultSet from GetGeneratedKeysHelper.getGeneratedKey(insert) is closed in a finally block, the memory leak vanishes (this applies to Hibernate 3.2.4). I don't know whether this is a specific problem of the MySQL JDBC driver (I use version 5.0.5), but as the additional code does not seem to hurt, I'd suggest to put it into the next Hibernate version.
Greetings,
Christian
> Unclosed ResultSet when using Identity
> --------------------------------------
>
> Key: HHH-1312
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1312
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc2, 3.1 rc3, 3.1
> Environment: JBoss 4.0.3SP1
> Hibernate 3.1rc2
> Java 1.5.0_06
> MSSQLServer 2000
> Reporter: Michael Samblanet
> Priority: Minor
>
> The code around AbstractEntityPersister.java line 1969 obtains a result set using GetGeneratedKeysHelper.getGeneratedKey
> but the result set is never closed by this function nor the functions it calls. The issue was exposed by the
> message below in JBoss 4.0.3 SP1.
> This is an EJB3 application on JBoss using MSSQLServer 2000 and we are persisting an object with a primary key using an
> identity data type.
> A review of the Hibernate 3.1 source code seems to indicate it has the same issue.
> 11:29:30,817 WARN [WrappedConnection] Closing a result set you left open! Please close it yourself.
> java.lang.Throwable: STACKTRACE
> at org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedStatement.java:572)
> at org.jboss.resource.adapter.jdbc.WrappedStatement.getGeneratedKeys(WrappedStatement.java:501)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.hibernate.util.GetGeneratedKeysHelper.getGeneratedKey(GetGeneratedKeysHelper.java:59)
> at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1969)
> at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2404)
> at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:37)
> at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
> at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:269)
> at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
> at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
> at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
> at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
> at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
> at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:590)
> at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:568)
> at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:130)
> at org.jboss.ejb3.entity.InjectedEntityManager.persist(InjectedEntityManager.java:97)
> <snip>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 7 months
[Hibernate-JIRA] Commented: (EJB-174) Ejb3Configuration can't open EJB Jar file with persistence.xml in Oracle OC4J server (Jifeng Liu)
by Mikhail Fedorov (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/EJB-174?page=co... ]
Mikhail Fedorov commented on EJB-174:
-------------------------------------
It is dummy path to remove this error after first look to code (3am :), ).
//file Ejb3Configuration
private void scanForClasses(URL jar, List<String> packages, List<String> entities, List<NamedInputStream> hbmFiles, boolean[] detectedArtifacts, boolean searchORM) {
if (jar == null) {
log.error( "Container is providing a null PersistenceUnitRootUrl: discovery impossible");
return;
}
try {
//Path ....
String url1=jar.getFile();
if (url1.startsWith("code-source")){
url1=url1.replace("code-source","file");
}
if (url1.startsWith("/")){
url1="file:"+url1;
}
if (url1.endsWith("!/")){
url1=url1.replace("!/","");
}
jar = new URL(url1);
//End Path
JarVisitor visitor = JarVisitor.getVisitor( jar, getFilters( detectedArtifacts, searchORM, null ) );
addScannedEntries( visitor, entities, packages, hbmFiles, null );
}
catch (RuntimeException e) {
throw new RuntimeException( "error trying to scan <jar-file>: " + jar.toString(), e );
}
catch( IOException e ) {
throw new RuntimeException( "Error while reading " + jar.toString(), e );
}
}
> Ejb3Configuration can't open EJB Jar file with persistence.xml in Oracle OC4J server (Jifeng Liu)
> -------------------------------------------------------------------------------------------------
>
> Key: EJB-174
> URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-174
> Project: Hibernate Entity Manager
> Issue Type: Bug
> Components: EntityManager
> Affects Versions: 3.1.0.Beta8
> Environment: Hibernate core 3.2rc1; Hibernate Annotation 3.1.0 beta 10
> Oracle OC4J 10.1.13
> Oracle 9
> Reporter: Jifeng Liu
> Assignee: Emmanuel Bernard
> Priority: Minor
> Fix For: 3.2.0.cr2
>
>
> In Oracle OC4J server, I created an EJB jar file, ejbSenior.jar, and put persistence.xml in its /META-INF folder. After deploying this EJB jar, I called javax.persistence.Persistence.createEntityManagerFactory("hibernate"). I got the following debug information and exception stack trace:
> 14:36:23 DEBUG Ejb3Configuration - Archive to be processed by hibernate Entity Manager implementation found
> 14:36:23 DEBUG JarVisitor - Searching mapped entities in jar/par: code-source:/C:/my/ws31/NewOC4J/ora92/j2ee/home/applic
> ations/SeniorApps/ejbSenior.jar
> 14:36:23 DEBUG Ejb3Configuration - Persistence unit name: hibernate
> 14:36:23 DEBUG Ejb3Configuration - emname:hibernate metadata: hibernate
> 14:36:23 WARN InputStreamZippedJarVisitor - Unable to find file (ignored): code-source:/C:/my/ws31/NewOC4J/ora92/j2ee/h
> ome/applications/SeniorApps/ejbSenior.jar
> java.io.IOException: code-source:/C:/my/ws31/NewOC4J/ora92/j2ee/home/applications/SeniorApps/ejbSenior.jar has no "!<pat
> h>" suffix so does not name a path within the code-source.
> at oracle.classloader.SharedCodeSourceSet.getResourceStream(SharedCodeSourceSet.java:482)
> at oracle.classloader.SharedCodeSourceURL$Connection.getInputStream(SharedCodeSourceURL.java:93)
> at java.net.URL.openStream(URL.java:1007)
> at org.hibernate.ejb.packaging.InputStreamZippedJarVisitor.doProcessElements(InputStreamZippedJarVisitor.java:33)
> at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:208)
> at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:201)
> at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:183)
> at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
> at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
> at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
> at com.senior.dal.shared.util.HbSessionFactory.getEntityManagerFactory(HbSessionFactory.java:40)
> After debugging it, I found Oracle OC4J's class loader creates a special URL with protocol 'code-source'. You can use this URL to get any resource inside EJB jar file. But you can't use it to read the EJB jar file itself.
> I wrote a small patch to fix it by changing the URL to an URL pointing to a file:
> In org.hibernate.ejb.packaging.JarVisitor java file, I add new code between "patch begins" and "patch ends" comment:
> public static final URL getJarURLFromURLEntry(URL url, String entry) throws IllegalArgumentException {
> URL jarUrl;
> String file = url.getFile();
> if ( ! entry.startsWith( "/" ) ) entry = "/" + entry;
> file = file.substring( 0, file.length() - entry.length() );
> if ( file.endsWith( "!" ) ) file = file.substring( 0, file.length() - 1 );
> try {
>
> if ( "jar".equals( url.getProtocol() ) ) {
> jarUrl = new URL( file );
> }
> // patch starts
> else if ("code-source".equals( url.getProtocol() ) ) {
> jarUrl = new File(file).toURL();
> }
> // patch ends
> else {
> jarUrl = new URL( url.getProtocol(), url.getHost(), url.getPort(), file );
> }
> }
> catch (MalformedURLException e) {
> throw new IllegalArgumentException(
> "Unable to determine JAR Url from " + url + ". Cause: " + e.getMessage()
> );
> }
> return jarUrl;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 7 months
[Hibernate-JIRA] Commented: (EJB-174) Ejb3Configuration can't open EJB Jar file with persistence.xml in Oracle OC4J server (Jifeng Liu)
by Mikhail Fedorov (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/EJB-174?page=co... ]
Mikhail Fedorov commented on EJB-174:
-------------------------------------
I have similar error in version from subversion repository on 2007-08-20 day.
007-08-20 01:03:05,156 [RMICallHandler-5] DEBUG org.hibernate.ejb.packaging.JarVisitor - Searching mapped entities in jar/par: code-source:/G:/WORK/java/AppServers/oc4j_101330/j2ee/home/applications/OracleTestAnnEAR/EjbAnn.jar!/
2007-08-20 01:03:05,156 [RMICallHandler-5] WARN org.hibernate.ejb.packaging.InputStreamZippedJarVisitor - Unable to find file (ignored): code-source:/G:/WORK/java/AppServers/oc4j_101330/j2ee/home/applications/OracleTestAnnEAR/EjbAnn.jar!/
java.io.IOException: code-source:/G:/WORK/java/AppServers/oc4j_101330/j2ee/home/applications/OracleTestAnnEAR/EjbAnn.jar!/ has no "!/<path>" suffix so does not name a path within the code-source.
at oracle.classloader.SharedCodeSourceSet.getResourceStream(SharedCodeSourceSet.java:505)
at oracle.classloader.SharedCodeSourceURL$Connection.getInputStream(SharedCodeSourceURL.java:107)
at java.net.URL.openStream(URL.java:1007)
at org.hibernate.ejb.packaging.InputStreamZippedJarVisitor.doProcessElements(InputStreamZippedJarVisitor.java:33)
at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:240)
at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:275)
at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:601)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:347)
> Ejb3Configuration can't open EJB Jar file with persistence.xml in Oracle OC4J server (Jifeng Liu)
> -------------------------------------------------------------------------------------------------
>
> Key: EJB-174
> URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-174
> Project: Hibernate Entity Manager
> Issue Type: Bug
> Components: EntityManager
> Affects Versions: 3.1.0.Beta8
> Environment: Hibernate core 3.2rc1; Hibernate Annotation 3.1.0 beta 10
> Oracle OC4J 10.1.13
> Oracle 9
> Reporter: Jifeng Liu
> Assignee: Emmanuel Bernard
> Priority: Minor
> Fix For: 3.2.0.cr2
>
>
> In Oracle OC4J server, I created an EJB jar file, ejbSenior.jar, and put persistence.xml in its /META-INF folder. After deploying this EJB jar, I called javax.persistence.Persistence.createEntityManagerFactory("hibernate"). I got the following debug information and exception stack trace:
> 14:36:23 DEBUG Ejb3Configuration - Archive to be processed by hibernate Entity Manager implementation found
> 14:36:23 DEBUG JarVisitor - Searching mapped entities in jar/par: code-source:/C:/my/ws31/NewOC4J/ora92/j2ee/home/applic
> ations/SeniorApps/ejbSenior.jar
> 14:36:23 DEBUG Ejb3Configuration - Persistence unit name: hibernate
> 14:36:23 DEBUG Ejb3Configuration - emname:hibernate metadata: hibernate
> 14:36:23 WARN InputStreamZippedJarVisitor - Unable to find file (ignored): code-source:/C:/my/ws31/NewOC4J/ora92/j2ee/h
> ome/applications/SeniorApps/ejbSenior.jar
> java.io.IOException: code-source:/C:/my/ws31/NewOC4J/ora92/j2ee/home/applications/SeniorApps/ejbSenior.jar has no "!<pat
> h>" suffix so does not name a path within the code-source.
> at oracle.classloader.SharedCodeSourceSet.getResourceStream(SharedCodeSourceSet.java:482)
> at oracle.classloader.SharedCodeSourceURL$Connection.getInputStream(SharedCodeSourceURL.java:93)
> at java.net.URL.openStream(URL.java:1007)
> at org.hibernate.ejb.packaging.InputStreamZippedJarVisitor.doProcessElements(InputStreamZippedJarVisitor.java:33)
> at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:208)
> at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:201)
> at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:183)
> at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
> at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
> at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
> at com.senior.dal.shared.util.HbSessionFactory.getEntityManagerFactory(HbSessionFactory.java:40)
> After debugging it, I found Oracle OC4J's class loader creates a special URL with protocol 'code-source'. You can use this URL to get any resource inside EJB jar file. But you can't use it to read the EJB jar file itself.
> I wrote a small patch to fix it by changing the URL to an URL pointing to a file:
> In org.hibernate.ejb.packaging.JarVisitor java file, I add new code between "patch begins" and "patch ends" comment:
> public static final URL getJarURLFromURLEntry(URL url, String entry) throws IllegalArgumentException {
> URL jarUrl;
> String file = url.getFile();
> if ( ! entry.startsWith( "/" ) ) entry = "/" + entry;
> file = file.substring( 0, file.length() - entry.length() );
> if ( file.endsWith( "!" ) ) file = file.substring( 0, file.length() - 1 );
> try {
>
> if ( "jar".equals( url.getProtocol() ) ) {
> jarUrl = new URL( file );
> }
> // patch starts
> else if ("code-source".equals( url.getProtocol() ) ) {
> jarUrl = new File(file).toURL();
> }
> // patch ends
> else {
> jarUrl = new URL( url.getProtocol(), url.getHost(), url.getPort(), file );
> }
> }
> catch (MalformedURLException e) {
> throw new IllegalArgumentException(
> "Unable to determine JAR Url from " + url + ". Cause: " + e.getMessage()
> );
> }
> return jarUrl;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 7 months
[Hibernate-JIRA] Created: (HBX-972) IndexOutOfBoundsException thrown in Hibernate Code Generation
by James Black (JIRA)
IndexOutOfBoundsException thrown in Hibernate Code Generation
-------------------------------------------------------------
Key: HBX-972
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-972
Project: Hibernate Tools
Issue Type: Bug
Environment: Hibernate Tools 3.2.0 beta 9
WinXP
Eclipse 3.2 and 3.3
JDK1.6
Reporter: James Black
I got this, due to my error, but there appears to be an assumption else the exception wouldn't be thrown.
I posted more about this on the Hibernate Tools forum.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.remove(Unknown Source)
at org.hibernate.tool.hbm2x.DocExporter.generatePackageSummary(DocExporter.java:386)
at org.hibernate.tool.hbm2x.DocExporter.doStart(DocExporter.java:161)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate$1.execute(CodeGenerationLaunchDelegate.java:257)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:89)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.runExporters(CodeGenerationLaunchDelegate.java:228)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:130)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:766)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:608)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:899)
at org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlugin.java:1102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 8 months
[Hibernate-JIRA] Created: (HHH-2794) Composite ID objects with set of objects with same composite ID using query loading only loads one object
by Matthew Morrissette (JIRA)
Composite ID objects with set of objects with same composite ID using query loading only loads one object
---------------------------------------------------------------------------------------------------------
Key: HHH-2794
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2794
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1
Environment: Hibernate3 3.2.1, Database is DB2 v8.2.5
Reporter: Matthew Morrissette
Priority: Blocker
Basically the gist is you have a parent data object with a composite identifier. You then have a child object with the same composite identifier and a set mapping in the parent object to a set of child objects. The set mapping uses a native-sql named query to load it's members (and relies upon that composite identifier for loading). When you query the parent object after retrieiving it from the session and iterate over the set, there is always zero or one members in the parent object no matter if that sql query returned multiple rows or not. In the below example the printed result should show two child objects: one with value1=val1 and value2=val2 and one with value1=val3 and value2=val4. However only the first child object is returned.
See code examples below (sql for building db is included as well):
TestParentObject.java:
import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
public class TestParentObject implements Serializable
{
private long id1, id2;
private Collection subobjects;
/**
* @return the id1
*/
public long getId1()
{
return id1;
}
/**
* @param id1 the id1 to set
*/
public void setId1(long id1)
{
this.id1 = id1;
}
/**
* @return the id2
*/
public long getId2()
{
return id2;
}
/**
* @param id2 the id2 to set
*/
public void setId2(long id2)
{
this.id2 = id2;
}
/**
* @return the subobjects
*/
public Collection getSubobjects()
{
return subobjects;
}
/**
* @param subobjects the subobjects to set
*/
public void setSubobjects(Collection subobjects)
{
this.subobjects = subobjects;
}
public String toString()
{
String out = "Parent{id1=" + id1 + ",id2=" + id2 + ",subobjects=[";
for (Iterator iter = subobjects.iterator();iter.hasNext();)
{
final TestSubObject obj = (TestSubObject)iter.next();
out += "SubObject{id1=" + obj.getId1() + ",id2=" + obj.getId2() + ",value1=" + obj.getValue1() + ",value2=" + obj.getValue2() + "}";
}
out += "]}";
return out;
}
}
TestSubObject.java:
import java.io.Serializable;
public class TestSubObject implements Serializable
{
private TestParentObject parent;
private String value1,value2;
/**
* @return the id1
*/
public long getId1()
{
return parent.getId1();
}
/**
* @return the id2
*/
public long getId2()
{
return parent.getId2();
}
/**
* @return the value1
*/
public String getValue1()
{
return value1;
}
/**
* @param value1 the value1 to set
*/
public void setValue1(String value1)
{
this.value1 = value1;
}
/**
* @return the value2
*/
public String getValue2()
{
return value2;
}
/**
* @param value2 the value2 to set
*/
public void setValue2(String value2)
{
this.value2 = value2;
}
/**
* @return the parent
*/
public TestParentObject getParent()
{
return parent;
}
/**
* @param parent the parent to set
*/
public void setParent(TestParentObject parent)
{
this.parent = parent;
}
}
TestParentObject.hbm.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.harrahs.enterprise.ggwu.dataobjects">
<class name="TestParentObject" table="PARENT"
<composite-id>
<key-property name="id1" type="long" />
<key-property name="id2" type="long" />
</composite-id>
<set name="subobjects" inverse="true">
<key>
<column name="id1" />
<column name="id2" />
</key>
<one-to-many class="TestSubObject" />
<loader query-ref="subObj" />
</set>
</class>
<class name="TestSubObject" table="SUBOBJECT">
<composite-id>
<key-many-to-one name="parent" class="TestParentObject">
<column name="id1"/>
<column name="id2"/>
</key-many-to-one>
</composite-id>
<property name="value1"/>
<property name="value2"/>
</class>
<sql-query name="subObj">
<load-collection alias="sub" role="TestParentObject.subobjects" />
SELECT {sub.*} FROM SUBOBJECT AS SUB WHERE ID1 = ? AND ID2 = ? WITH UR
</sql-query>
</hibernate-mapping>
TestObject.java:
import junit.framework.TestCase;
public class TestObject extends TestCase
{
public void testParentObj()
{
final Session session = HibernateUtil.openSession();
session.beginTransaction();
final TestParentObject obj = (TestParentObject)session.createCriteria(TestParentObject.class).add(Restrictions.eq("id1",new Long(1))).add(Restrictions.eq("id2",new Long(2))).uniqueResult();
System.out.println(obj);
session.getTransaction().commit();
session.flush();
HibernateUtil.closeSession();
}
}
GenerateDB.sql:
CREATE TABLE PARENT (
ID1 BIGINT,
ID2 BIGINT) IN USERSPACE1;
CREATE TABLE SUBOBJECT (
ID1 BIGINT,
ID2 BIGINT,
VALUE1 VARCHAR(255),
VALUE2 VARCHAR(255)) IN USERSPACE1;
INSERT INTO VALUES (1,2);
INSERT INTO PARENT VALUES (2,2);
INSERT INTO SUBOBJECT VALUES (1,2,'val1','val2');
INSERT INTO SUBOBJECT VALUES (1,2,'val3','val4');
INSERT INTO SUBOBJECT VALUES (2,2,'val5','val6');
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 8 months
[Hibernate-JIRA] Commented: (HHH-1786) JTASessionContext.CleanupSynch does not remove sessions from currentSessionMap
by Reggie Riser (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1786?page=c... ]
Reggie Riser commented on HHH-1786:
-----------------------------------
Steve ... I followed up again with the WebSphere Transaction Architect. Here's what he said:
"The new integration points are publically available in WAS since 6.0.2.19 and 6.1.0.9, but not before. The javadoc for this API missed 6.0.2.19 and will be part of 6.0.2.23.
Having said that, the ExtendedJTATransaction interface that Hibernate is using is and remains fully supported, so they won't need to change to move away from that; the new APIs offer context management integration (e.g. suspend/resume) which Hibernate doesn't need."
> JTASessionContext.CleanupSynch does not remove sessions from currentSessionMap
> ------------------------------------------------------------------------------
>
> Key: HHH-1786
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1786
> Project: Hibernate3
> Issue Type: Improvement
> Affects Versions: 3.1.2
> Environment: IBM WebSphere 6.0.2.7, Hibernate CVS snapshot from 2006-02-24
> Reporter: Tomi Szabo
> Assignee: Steve Ebersole
> Fix For: 3.3
>
> Attachments: JTASessionContext.java, WebSphereExtendedJTATransactionLookup.java, WebSphereExtendedJTATransactionLookup.patch.txt
>
>
> We are using JTASessionContext, CMTTransaction and WebSphereExtendedJTATransactionLookup. We have experienced some memmory leak problems and after closer inspection we have found that Hibernate sessions are not removed from currentSessionMap inside JTASessionContext.
> Method JTASessionContext.CleanupSynch.afterCompletion() is called as expected but code "context.currentSessionMap.remove( txn );" does not remove session from Map because of key's hashcode has changed. This is due to fact that com.ibm.websphere.jtaextensions.ExtendedJTATransaction.hashCode is actually ID of underlaying transaction. But if it comes to the afterCompletion method in CleanupSynch the underlaying transaction is already closed. Closed transaction has ID 0 (default value) and it is different from ID under which the Hibernate session was previously inserted into Map.
> Possible patch is in attachements.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 8 months
[Hibernate-JIRA] Commented: (HHH-1479) Incompatibility of Hibernate 3.1 and JTOpen JDBC drivers for IBM AS/400
by diamond (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1479?page=c... ]
diamond commented on HHH-1479:
------------------------------
We are currently using Hibernate 3.2.3 ga with JTOpen 5.4.0.4 without this issue
> Incompatibility of Hibernate 3.1 and JTOpen JDBC drivers for IBM AS/400
> -----------------------------------------------------------------------
>
> Key: HHH-1479
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1479
> Project: Hibernate3
> Issue Type: Patch
> Affects Versions: 3.1
> Environment: Hibernate 3.1
> JDBC driver: JTOpen (for IBM AS/400) http://jt400.sourceforge.net
> Reporter: Davide Rogora
> Assignee: Steve Ebersole
>
> Hello,
> I've noticed that from version 3.1 Hibernate, when calling JDBC driver for INSERT statement, uses the following prepareStatement method:
> prepareStatement(String sql, String[] columnNames)
> instead of the following
> prepareStatement(String sql, int autoGeneratedKeys)
> used since versione 3.0.x
> the problem is that JDBC driver for AS/400 (project JTOpen on sourceforge: http://jt400.sourceforge.net) doesn't support the method prepareStatement(String sql, String[] columnNames) so it's not possible to use Hibernate 3.1 with AS/400
> I've also noticed that other open source drivers that support this method (for example MySQL Jdbcconnector or JTDS for Ms-SQLServer) have implemented it using a workaround; infact they call the "old" prepareStatement(String sql, int autoGeneratedKeys) method ignoring the content of the columnNames array.
> Here is the source of the jtds implementation:
> -------------------------------------------------------------------------------
> public PreparedStatement prepareStatement(String sql, String[] columnNames)
> throws SQLException {
> if (columnNames == null) {
> throw new SQLException(
> Messages.get("error.generic.nullparam", "prepareStatement"),"HY092");
> } else if (columnNames.length != 1) {
> throw new SQLException(
> Messages.get("error.generic.needcolname", "prepareStatement"),"HY092");
> }
> return prepareStatement(sql, JtdsStatement.RETURN_GENERATED_KEYS);
> }
> -------------------------------------------------------------------------------
> So I'm asking to the Hibernate team if it's possible to use the old method prepareStatement(String sql, int autoGeneratedKeys) in the future releases of Hibernate.
> Thanks,
> Davide Rogora.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 8 months