[Hibernate-JIRA] Created: (EJB-232) Better documentation for <jar-file> and scanning outside of PU root
by Christian Bauer (JIRA)
Better documentation for <jar-file> and scanning outside of PU root
-------------------------------------------------------------------
Key: EJB-232
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-232
Project: Hibernate Entity Manager
Type: Improvement
Components: Documentation
Reporter: Christian Bauer
Priority: Minor
> > I'm trying to solve a problem that people will face as soon as they
> > do unit testing. Given the following directories with classes:
> >
> > - build/classes/MyModel.class @Entity
> > - build/testclasses/META-INF/persistence.xml
> >
> > This doesn't work because the PU root is build/testclasses, and
> > there are no entities there. I've tried to use <jar-file>file://
> > build/classes</jar-file> to point the scanner to that directory,
> > but it doesn't work either. Apparently it has to be a JAR file.
> >
> > Maybe we should introduce a syntax or fallback for <jar-file> to
> > scan a directory. I see no other way how I could split my entity
> > build path from the test configuration build path. It's almost
> > impossible to find a project layout in an IDE where you could get
> > both together and not run into all kinds of issues.
>
> Oh, it works. I had a slash too many in my URL. Maybe we should add
> this to the documentation:
>
> <jar-file>file:/home/turin/work/local/lab8/build/classes</jar-file>
--
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
19 years
[Hibernate-JIRA] Created: (EJB-243) Error in Documentation: persistence.xml for typical Java SE Environment
by Michael Plöd (JIRA)
Error in Documentation: persistence.xml for typical Java SE Environment
-----------------------------------------------------------------------
Key: EJB-243
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-243
Project: Hibernate Entity Manager
Type: Improvement
Components: Documentation
Versions: 3.2.0.ga
Reporter: Michael Plöd
Hi,
I just found out that there is a small bug in the example persistence.xml file for a Typical Java SE environment in Chapter 2.2.2 Bootstrapping:
The xml file is as follows:
<persistence>
<persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL">
<class>org.hibernate.ejb.test.Cat</class>
<class>org.hibernate.ejb.test.Distributor</class>
<class>org.hibernate.ejb.test.Item</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:."/>
<property name="hibernate.max_fetch_depth" value="3"/>
<!-- cache configuration -->
<property name="hibernate.ejb.classcache.org.hibernate.ejb.test.Item" value="read-write"/>
<property name="hibernate.ejb.collectioncache.org.hibernate.ejb.test.Item.distributors" value="read-write, RegionName"/>
<!-- alternatively to <class> and <property> declarations, you can use a regular hibernate.cfg.xml file -->
<!-- property name="hibernate.ejb.cfgfile" value="/org/hibernate/ejb/test/hibernate.cfg.xml"/ -->
</properties>
<persistence-unit>
</persistence>
The error is that the <persistence-unit> is not being closed by </persistence-unit> (look two lines up from here) ...
The documentation says:
...
<persistence-unit>
....
<persistence-unit> <---- this must me </persistence-unit>
</persistence>
--
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
19 years
[Hibernate-JIRA] Created: (HHH-2221) Bulk-update of joined-subclass doesn't work with
by Donnchadh O Donnabhain (JIRA)
Bulk-update of joined-subclass doesn't work with
-------------------------------------------------
Key: HHH-2221
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2221
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.ga
Environment: INFO: Hibernate 3.2.0
INFO: RDBMS: MySQL, version: 5.0.22
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.4 ( $Date: 2006-10-19 17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )
Reporter: Donnchadh O Donnabhain
Attachments: JoinedSubclassTest.java
I've created the following test (in JoinedSubclassTest) which reporduced the problem:
public void testBulkUpdateJoinedSubclass() {
Session s = openSession();
Transaction t = s.beginTransaction();
Employee mark = new Employee();
mark.setName("Mark");
mark.setTitle("internal sales");
mark.setSex('M');
mark.setAddress("buckhead");
mark.setZip("30305");
mark.setCountry("USA");
s.save(mark);
String hql = "update Employee employee set employee.sex=:newSex where employee.id in (:ids)";
Query query = s.createQuery(hql);
query.setCharacter("newSex", 'F');
List ids = new ArrayList();
ids.add(Long.valueOf(mark.getId()));
query.setParameterList("ids", ids);
query.executeUpdate();
s.delete(mark);
t.commit();
s.close();
}
and run it with the following properties:
-Dhibernate.dialect=org.hibernate.dialect.MySQLDialect
-Dhibernate.connection.driver_class=com.mysql.jdbc.Driver
-Dhibernate.connection.url=jdbc:mysql://127.0.0.1/hibernateTest
-Dhibernate.connection.username=username
-Dhibernate.connection.password=password
This produces the following error:
org.hibernate.exception.SQLGrammarException: could not insert/select ids for bulk update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.exec.MultiTableUpdateExecutor.execute(MultiTableUpdateExecutor.java:127)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:396)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1141)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
at org.hibernate.test.joinedsubclass.JoinedSubclassTest.testBulkUpdateJoinedSubclass(JoinedSubclassTest.java:131)
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:589)
at junit.framework.TestCase.runTest(TestCase.java:164)
at org.hibernate.test.TestCase.runTest(TestCase.java:247)
at junit.framework.TestCase.runBare(TestCase.java:130)
at org.hibernate.test.TestCase.runBare(TestCase.java:313)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'hibernateTest.HT_JEmployee' doesn't exist
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3176)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1153)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1404)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1318)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1303)
at org.hibernate.hql.ast.exec.MultiTableUpdateExecutor.execute(MultiTableUpdateExecutor.java:118)
... 26 more
This works fine in hibernate 3.1.3.
The problem seems to be in AbstractStatementExecutor. It seems to assume that if a DDL statement, in general, results in a commit that this will also happen for a temporary table. In the case of MySQL, at least, this is not the case. The code in AbstractStatementExecutor goes and creates the temporary table in a new connection, which, in the case of MySQL, will
not be visible in the current transaction.
http://fisheye.jboss.com/browse/Hibernate/branches/Branch_3_2/Hibernate3/...
--
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
19 years
[Hibernate-JIRA] Created: (EJB-240) attribute-override and embedded in orm.xml not working
by Thomas Risberg (JIRA)
attribute-override and embedded in orm.xml not working
------------------------------------------------------
Key: EJB-240
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-240
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.0.ga
Environment: 3.2.0GA + HA 3.2.0GA + HEM 3.2.0GA
Reporter: Thomas Risberg
Embedding an Address class twice and need to override the column names. Using orm.xml and <embedded> plus <attribute-override> does not work while the same construct works using annotations. The orm.xml works in the RI.
<embeddable class="jpatest.Address">
<attributes>
<basic name="street"/>
<basic name="city"/>
<basic name="state"/>
<basic name="zip"/>
</attributes>
</embeddable>
<entity class="jpatest.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>
--
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
19 years
[Hibernate-JIRA] Created: (ANN-425) @ManyToOne defined as @Id in a @MappedSuperclass/@EmbeddableSuperclass can't be reached by an @OneToMany(mappedBy)
by Giampaolo Tomassoni (JIRA)
@ManyToOne defined as @Id in a @MappedSuperclass/@EmbeddableSuperclass can't be reached by an @OneToMany(mappedBy)
------------------------------------------------------------------------------------------------------------------
Key: ANN-425
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-425
Project: Hibernate Annotations
Type: Bug
Versions: 3.1beta3, 3.1beta4, 3.1beta5, 3.1beta6, 3.1beta7, 3.1beta8, 3.1beta9, 3.1.0.Beta10, 3.2.0.cr1
Environment: hibernate-3.2.CR2 + hibernate-annotations-3.2.0-CR1 + hibernate-entitymanager-3.2.0-CR1 under JBoss 4.0.4-GA and EJB3
Reporter: Giampaolo Tomassoni
Attachments: test01.zip
The case in subject reports the following error:
org.hibernate.AnnotationException: mappedBy reference an unknown property: biz.tomassoni.hibernate.test01.AB.a in biz.tomassoni.hibernate.test01.A.a
It is months now that this problem had been reported (by me and by other), but no progress.
I'm attaching a testcase in the hope it can be useful.
--
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
19 years
[Hibernate-JIRA] Created: (ANN-450) @MapKey does not work with embedded fields
by Bryan Brouckaert (JIRA)
@MapKey does not work with embedded fields
------------------------------------------
Key: ANN-450
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-450
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.0.cr3
Environment: Windows, JBoss Embedded EJB3 with the latested Hibernate Libaries (manually replaced)
Reporter: Bryan Brouckaert
@javax.persistence.MapKey does not seem to work with @embedded fields.
The following is programmed (simplified):
@Entity
public class MyClass
{
@Id
@GeneratedValue
private int id;
@MapKey(name="myKey")
private Map<KeyClass, OtherClass> myField;
...
}
@Entity
public class OtherClass
{
@Id
@GeneratedValue
private int id;
@Embedded
private KeyClass myKey;
...
}
@Embeddable
public class KeyClass
{
private String key1;
private String key2;
}
The following exception is thrown:
ERROR 11-10 08:52:30,862 (AbstractController.java:incrementState:440) -Error installing to Start: name=persistence.units:jar=sidecam.jar,unitName=sidecam state=Create
java.lang.ArrayIndexOutOfBoundsException: 1
at org.hibernate.sql.SimpleSelect.addColumns(SimpleSelect.java:41)
at org.hibernate.persister.collection.AbstractCollectionPersister.generateSelectRowByIndexString(AbstractCollectionPersister.java:894)
at org.hibernate.persister.collection.AbstractCollectionPersister.<init>(AbstractCollectionPersister.java:478)
at org.hibernate.persister.collection.OneToManyPersister.<init>(OneToManyPersister.java:60)
at org.hibernate.persister.PersisterFactory.createCollectionPersister(PersisterFactory.java:72)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:250)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107)
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:75)
at org.jboss.kernel.plugins.dependency.LifecycleAction.installAction(LifecycleAction.java:115)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:100)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:709)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:429)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:538)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:472)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:274)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:177)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:79)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:73)
at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:131)
at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:467)
at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:317)
at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:478)
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:235)
at be.sigedis.argo.sidecam.tests.ServiceCarriereTest.startupEmbeddedJboss(ServiceCarriereTest.java:55)
at be.sigedis.argo.sidecam.tests.ServiceCarriereTest$1.setUp(ServiceCarriereTest.java:41)
at junit.extensions.TestSetup$1.protect(TestSetup.java:18)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)
--
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
19 years