[Hibernate-JIRA] Commented: (HHH-614) SchemaUpdate broken in DB2/400
by Marcello Mazzotti (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-614?page=co... ]
Marcello Mazzotti commented on HHH-614:
---------------------------------------
i have the same bug on hibernate 3.2.6ga using db2400 v5r3. QSYS2.SYSSEQUENCES is the correct table to discover sequences on db2/400.
> SchemaUpdate broken in DB2/400
> ------------------------------
>
> Key: HHH-614
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-614
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: Hibernate running on Windows XP Professional and jre 1.5. Database running on i5/OS V5R3M0. jt400 toolbox driver.
> Reporter: Jouni Rajala
> Fix For: 3.1 beta 1
>
>
> When running SchemaUpdate, i get exceptions out that indicate problems with sql dialect. SQL Exception says:
> java.sql.SQLException: [SQL0204] Kirjaston SYSIBM *FILE-lajista objektia SYSSEQUENCES ei löydy.
> Which is translated as 'table SYSSEQUENCES is not found in schema SYSIBM' (not sure about correct translation to english but I am sure you get the meaning).
> It shows that you try to use DB2 syntax DB2/8.1 or something similar which has SYSIBM.SYSSEQUENCES table existing. This table however does not exists in DB2/400 and sequences are handled differently.
> When I use SchemaExport utility, everything works just fine. So it is probably just leftover from somewhere.
--
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
17 years, 9 months
[Hibernate-JIRA] Created: (HBX-1067) [SchemaExport] Duplicate unique constraint with unique="true" and natural-id
by Vincent Ricard (JIRA)
[SchemaExport] Duplicate unique constraint with unique="true" and natural-id
----------------------------------------------------------------------------
Key: HBX-1067
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1067
Project: Hibernate Tools
Issue Type: Bug
Affects Versions: 3.2.0.GA
Environment: Hibernate 3.2.5, MySQL 5.0.51 (InnoDB), Java 1.5
Reporter: Vincent Ricard
Priority: Minor
In my foo.hbm.xml, if i put this:
<natural-id>
<property name="barId" column="bar_id" not-null="true" length="128"/>
</natural-id>
SchemaExport creates this:
create table foo (id bigint not null auto_increment, version integer not null, bar_id varchar(128) not null, primary key (id), unique (bar_id)) ENGINE=InnoDB;
And MySQL creates only one index for bar_id.
But, if my foo.hbm.xml contains this:
<natural-id>
<property name="barId" column="bar_id" not-null="true" unique="true" length="128"/>
</natural-id>
SchemaExport generates this:
create table foo (id bigint not null auto_increment, version integer not null, bar_id varchar(128) not null unique, primary key (id), unique (bar_id)) ENGINE=InnoDB;
And MySQL creates 2 indices for bar_id.
So, i think it'd be cool if schemaexport was smarter (even if MySQL could be too).
--
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
17 years, 9 months
[Hibernate-JIRA] Commented: (HBX-524) Reverse of one-to-one relationships
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Max Rydahl Andersen commented on HBX-524:
-----------------------------------------
Looks good Marcio - any chance you could create a patch file - then it is much safer to apply and get what you did
> Reverse of one-to-one relationships
> -----------------------------------
>
> Key: HBX-524
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-524
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta2
> Environment: HIbernate 3.1, Oracle 9i
> Reporter: Andrea Cattani
>
> Hi,
> I've posted this issue to the forum and got this response from Max, Hibernate Team:
> "the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira."
> The problem I've faced is the following:
> I have two tables, let's say
> - table A with column ID (PK) and other fields
> - table B with column ID (PK) and other fields
> table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)
> When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:
> <class name="B" table="B" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned" />
> </id>
> <[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
> <column name="ID" length="12" not-null="true" unique="true" />
> </many-to-one>
> ....
> And this one for table A:
> <class name="A" table="A" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned"/>
> </id>
> <set name="b" inverse="true">
> <key>
> <column name="ID" length="12" not-null="true" unique="true" />
> </key>
> <[b]one-to-many[/b] class="B" />
> </set>
> </class>
> while I was expecting something like:
> [i]<one-to-one name="a" class="A" constrained="true"/>[/i]
> in table B, and the same (or nothing) in table A
> Thank you
> Andi
--
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
17 years, 9 months
[Hibernate-JIRA] Created: (EJB-372) Named query does not support entity attribute with generic type
by louie (JIRA)
Named query does not support entity attribute with generic type
---------------------------------------------------------------
Key: EJB-372
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-372
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.2.GA
Environment: hibernate-3.3.0.CR1, hibernate-annotations-3.4.0.CR1
Reporter: louie
Attachments: test-case.zip
We are using the generic to define a template for our entity.
For example, we have the following abstract template class:
@MappedSuperclass
public abstract class AbstractIdentifier<T> {
@Id
@SequenceGenerator(name = "AbstractIdentifier", sequenceName = "identifier_id")
@GeneratedValue(generator="AbstractIdentifier")
private int id;
@ManyToOne(optional=false)
private T entity;
....
}
We have the following concrete class:
@Entity
@AssociationOverride(name="entity", joinColumns=@JoinColumn(name="myEntity"))
public class Identifier extends AbstractIdentifier<MyEntity> {
public MyEntity getMyEntity () {
return super.getEntity();
}
public void setMyEntity (final MyEntity myEntity) {
super.setEntity(myEntity);
}
}
If we defined a named query, such as:
@NamedQueries( {
@NamedQuery(name = "myquery", query = "select idf.myEntity from Identifier idf where idf.identifier = :identifier")})
Then, at runtime, we got the following error message:
run:
[java] Executing 'C:\Program Files\Java\jdk1.6.0_05\jre\bin\java.exe' with arguments:
[java] '-classpath'
[java] 'C:\workspaces\test-case\test-case\lib\antlr-2.7.6.jar;C:\workspaces\test-case\test-case
\lib\cglib.jar;C:\workspaces\test-case\test-case\lib\commons-collections-3.1.jar;C:\workspaces\test-
case\test-case\lib\commons-logging-1.1.1.jar;C:\workspaces\test-case\test-case\lib\dom4j-1.6.1.jar;C
:\workspaces\test-case\test-case\lib\ejb3-persistence.jar;C:\workspaces\test-case\test-case\lib\free
marker.jar;C:\workspaces\test-case\test-case\lib\hibernate-annotations.jar;C:\workspaces\test-case\t
est-case\lib\hibernate-commons-annotations.jar;C:\workspaces\test-case\test-case\lib\hibernate-entit
ymanager.jar;C:\workspaces\test-case\test-case\lib\hibernate-tools.jar;C:\workspaces\test-case\test-
case\lib\hibernate3.jar;C:\workspaces\test-case\test-case\lib\hsqldb.jar;C:\workspaces\test-case\tes
t-case\lib\javassist-3.6.0.GA.jar;C:\workspaces\test-case\test-case\lib\jboss-archive-browsing.jar;C
:\workspaces\test-case\test-case\lib\jta.jar;C:\workspaces\test-case\test-case\lib\log4j-1.2.15.jar;
C:\workspaces\test-case\test-case\lib\ojdbc14.jar;C:\workspaces\test-case\test-case\lib\persistence-
api-1.0.jar;C:\workspaces\test-case\test-case\lib\persistence-api.jar;C:\workspaces\test-case\test-c
ase\lib\slf4j-api-1.4.2.jar;C:\workspaces\test-case\test-case\lib\slf4j-log4j12-1.5.2.jar;C:\workspa
ces\test-case\test-case\bin'
[java] 'Tester'
[java]
[java] The ' characters around the executable and arguments are
[java] not part of the command.
[java] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version
).
[java] log4j:WARN Please initialize the log4j system properly.
[java] Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.Hiberna
teException: Errors in named queries: myquery
[java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.j
ava:737)
[java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersis
tence.java:121)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
[java] at Tester.main(Unknown Source)
[java] Caused by: org.hibernate.HibernateException: Errors in named queries: myquery
[java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:374)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1304)
[java] at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfigura
tion.java:859)
[java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.j
ava:730)
[java] ... 4 more
[java] Java Result: 1
It looks like that hibernate can not parsing the generic type MyEntity correct.
Please help. Thanks.
--
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
17 years, 9 months
[Hibernate-JIRA] Commented: (HBX-524) Reverse of one-to-one relationships
by Marcio Carvalho (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Marcio Carvalho commented on HBX-524:
-------------------------------------
Ok Max.
I really implemented the aforementioned PK-FK LAW #2, which is the standard way to express one-to-one relations here in my job.
I've just changed the JDBCBinder class. Here are my changes:
1- method bindIncomingForeignKeys(): I inserted another condition asking if the current FK is a OneToOne relation. In case it is, I call the new method bindOneToOne() which is similar to bindOneToMany().
2- method isOneToOne(ForeignKey fk): I created this method to check whether the referred fk represents a OneToOne relation according to the PK-FK Law #2.
protected boolean isOneToOne(ForeignKey foreignKey) {
List fkColumns = foreignKey.getColumns();
List pkForeignTableColumns = null;
if (foreignKey.getTable().hasPrimaryKey())
pkForeignTableColumns = foreignKey.getTable().getPrimaryKey().getColumns();
boolean equals =
fkColumns != null && pkForeignTableColumns != null
&& fkColumns.size() == pkForeignTableColumns.size();
Iterator columns = foreignKey.getColumnIterator();
while (equals && columns.hasNext()) {
Column fkColumn = (Column) columns.next();
equals = equals && pkForeignTableColumns.contains(fkColumn);
}
return equals;
}
3- method bindOneToOne(): I created this method to actually compose the Property which has an org.hibernate.mapping.OneToOne value. It mostly resembles the bindOneToMany method.
private Property bindOneToOne(PersistentClass rc, Table table,
ForeignKey fk, Set processedColumns) {
OneToOne value = new OneToOne(table, rc);
value.setReferencedEntityName(revengStrategy
.tableToClassName(TableIdentifier.create(table)));
boolean isUnique = isUniqueReference(fk);
String propertyName =
revengStrategy.foreignKeyToEntityName(fk.getName(),
TableIdentifier.create(fk.getReferencedTable()), fk
.getReferencedColumns(), TableIdentifier
.create(table), fk.getColumns(), isUnique);
Iterator columns = fk.getColumnIterator();
while (columns.hasNext()) {
Column fkcolumn = (Column) columns.next();
checkColumn(fkcolumn);
value.addColumn(fkcolumn);
processedColumns.add(fkcolumn);
}
value.setFetchMode(FetchMode.SELECT);
return makeProperty(TableIdentifier.create(table), propertyName, value,
true, true, value.getFetchMode() != FetchMode.JOIN, null, null);
}
This are mostly the changes I made to recognize One-To-One relationships. To express this situation in my pojos, I 've put the correct annotations in my pojo templates.
Hope this helps.
Cheers,
Marcio
> Reverse of one-to-one relationships
> -----------------------------------
>
> Key: HBX-524
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-524
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta2
> Environment: HIbernate 3.1, Oracle 9i
> Reporter: Andrea Cattani
>
> Hi,
> I've posted this issue to the forum and got this response from Max, Hibernate Team:
> "the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira."
> The problem I've faced is the following:
> I have two tables, let's say
> - table A with column ID (PK) and other fields
> - table B with column ID (PK) and other fields
> table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)
> When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:
> <class name="B" table="B" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned" />
> </id>
> <[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
> <column name="ID" length="12" not-null="true" unique="true" />
> </many-to-one>
> ....
> And this one for table A:
> <class name="A" table="A" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned"/>
> </id>
> <set name="b" inverse="true">
> <key>
> <column name="ID" length="12" not-null="true" unique="true" />
> </key>
> <[b]one-to-many[/b] class="B" />
> </set>
> </class>
> while I was expecting something like:
> [i]<one-to-one name="a" class="A" constrained="true"/>[/i]
> in table B, and the same (or nothing) in table A
> Thank you
> Andi
--
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
17 years, 9 months
[Hibernate-JIRA] Created: (HSEARCH-212) Added a new very efficient ReaderProvider
by Sanne Grinovero (JIRA)
Added a new very efficient ReaderProvider
-----------------------------------------
Key: HSEARCH-212
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-212
Project: Hibernate Search
Issue Type: Improvement
Components: directory provider
Reporter: Sanne Grinovero
Assignee: Sanne Grinovero
Creating a new ReaderProvider, it should be faster and more scalable compared to the current ones.
Here are some numbers on a little 9MB index; it should improve on bigger indexes:
(SharingBufferReaderProvider is the name it had during tests)
using 100 threads:
Performance test for org.hibernate.search.reader.SharingBufferReaderProvider: 34735ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for org.hibernate.search.reader.SharingBufferReaderProvider: 34396ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for org.hibernate.search.reader.SharingBufferReaderProvider: 37347ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for org.hibernate.search.reader.SharingBufferReaderProvider: 36895ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for org.hibernate.search.reader.SharingBufferReaderProvider: 36100ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for shared: 42433ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for shared: 44830ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for shared: 40704ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for shared: 43685ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for not-shared: 50452ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for not-shared: 48171ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for not-shared: 52862ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for not-shared: 49999ms. (20000 searches, 1000 insertions, 2000 updates)
20 Threads:
Performance test for org.hibernate.search.reader.SharingBufferReaderProvider: 31133ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for org.hibernate.search.reader.SharingBufferReaderProvider: 31408ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for shared: 38170ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for shared: 36327ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for not-shared: 41712ms. (20000 searches, 1000 insertions, 2000 updates)
Performance test for not-shared: 42224ms. (20000 searches, 1000 insertions, 2000 updates)
--
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
17 years, 9 months