[Hibernate-JIRA] Created: (HHH-3621) Assertion failure in MigrationTest
by Juraci Paixao Krohling (JIRA)
Assertion failure in MigrationTest
----------------------------------
Key: HHH-3621
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3621
Project: Hibernate Core
Issue Type: Bug
Components: testsuite
Affects Versions: 3.3.x
Environment: Oracle 9i/Oracle 10g/Sybase 12/MySQL and Branch_3_3
Reporter: Juraci Paixao Krohling
The test testSimpleColumnAddition (org.hibernate.test.schemaupdate.MigrationTest) fails due to an assertion failure.
It seems something related to the environment, but as the tests are running without changes from SVN, it needs to be fixed. The tests are running using to the profiles specified in the "testsuite" maven configuration file.
Stack trace:
junit.framework.AssertionFailedError: expected:<0> but was:<1>
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.failNotEquals(Assert.java:277)
at junit.framework.Assert.assertEquals(Assert.java:64)
at junit.framework.Assert.assertEquals(Assert.java:195)
at junit.framework.Assert.assertEquals(Assert.java:201)
at org.hibernate.test.schemaupdate.MigrationTest.testSimpleColumnAddition(MigrationTest.java:42)
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 junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.hibernate.junit.UnitTestCase.runBare(UnitTestCase.java:63)
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:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
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)
--
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
15 years, 3 months
[Hibernate-JIRA] Created: (ANN-548) Joins break when using composite primary key classes
by Vincent Jenks (JIRA)
Joins break when using composite primary key classes
----------------------------------------------------
Key: ANN-548
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-548
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.1, 3.2.2
Environment: JBoss 4.0.5.GA w/ Hibernate 3.2.2 and Annoations 3.2.2 (from SVN). Also reproduced w/ JBoss 4.0.5.GA w/ stock annotations, hibernate, and entity manager, unmodified. The attached test-case was run against MSSQL 2000 but is trivial to point at another database. The issue was also reproduced on a OpenEdge Progress 10.1A database.
Reporter: Vincent Jenks
Attachments: CarBean.java, Carz.java, Lotz.java
Joins break when using composite primary key classes
JBoss 4.0.5.GA w/ Hibernate 3.2.2 and Annoations 3.2.2 (from SVN). Also reproduced w/ JBoss 4.0.5.GA w/ stock annotations, hibernate, and entity manager, unmodified. The attached test-case was run against MSSQL 2000 but is trivial to point at another database. The issue was also reproduced on a OpenEdge Progress 10.1A database.
In a case where there are composite keys on one (or each) side of a relationship, Hibernate cannot join the entities together if all of the primary key fields are not used in the relationship.
A (very) simple example, two entities Carz and Lotz (pardon the names, it's simply cars and car lots):
@Entity
@Table(name="car")
public class Carz implements Serializable
{
@Id
private Integer id;
@Column(name="make", nullable=false)
private String make;
@Column(name="model", nullable=false)
private String model;
@Column(name="manufactured", nullable=false)
@Temporal(TemporalType.TIMESTAMP)
private Date manufactured;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumns //Hibernate docs state that @JoinColumns must be used since Lotz has composite PK, a single @JoinColumn does not deploy anyhow
({
@JoinColumn(name="loc_code", referencedColumnName="loc_code", insertable=false, updatable=false)
})
private Lotz lot;
...........................
}
@Entity
@Table(name="lot")
public class Lotz implements Serializable
{
@EmbeddedId
protected LotzPK lotPK;
@Column(name="name", nullable=false)
private String name;
@Column(name="location", nullable=false)
private String location;
@OneToMany(mappedBy="lot", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
private List<Carz> cars;
...........................
}
@Embeddable
public class LotzPK implements Serializable
{
@Column(name="id", nullable=false)
private Integer id;
@Column(name="loc_code", nullable=false)
private String locCode;
...........................
}
In this case I need a one-to-many relationship on Carz.id = Lotz.locCode. However, there doesn't appear to be a way to do this.
When this is deployed, this exception occurs:
org.hibernate.AnnotationException: Column name id of hqb.model.Lotz not found in JoinColumns.referencedColumnName
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:306)
at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:64)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:433)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:287)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1211)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:847)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:385)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
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:597)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:102)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
...........................
I can deploy the app if I map both fields in the Lotz PK class like so:
@Entity
@Table(name="car")
public class Carz implements Serializable
{
@Id
private Integer id;
...........................
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumns
({
@JoinColumn(name="loc_code", referencedColumnName="loc_code", insertable=false, updatable=false),
@JoinColumn(name="", referencedColumnName="id", insertable=false, updatable=false) //INCORRECTLY DEFINED RELATIONSHIP!
})
private Lotz lot;
...........................
}
But obviously this is no good, it generates bad SQL at runtime:
/* select
c
from
Carz c
left join
fetch c.lot */ select
carz0_.id as id198_0_,
lotz1_.id as id199_1_,
lotz1_.loc_code as loc2_199_1_,
carz0_.make as make198_0_,
carz0_.model as model198_0_,
carz0_.manufactured as manufact4_198_0_,
carz0_.lot_id as lot5_198_0_,
carz0_.loc_code as loc6_198_0_, --no such column...
lotz1_.name as name199_1_,
lotz1_.location as location199_1_
from
car carz0_
left outer join
lot lotz1_
on carz0_.lot_id=lotz1_.id --oops! Hibernate defaulted a relationship here...
and carz0_.loc_code=lotz1_.loc_code
In reality, this is the SQL I'm trying to achieve, by repairing the above query manually:
select
carz0_.id as id198_0_,
lotz1_.id as id199_1_,
lotz1_.loc_code as loc2_199_1_,
carz0_.make as make198_0_,
carz0_.model as model198_0_,
carz0_.manufactured as manufact4_198_0_,
carz0_.loc_code as loc6_198_0_,
lotz1_.name as name199_1_,
lotz1_.location as location199_1_
from
car carz0_
left outer join
lot lotz1_
on carz0_.loc_code=lotz1_.loc_code
This is consistent w/ the EJB 3.0 spec (and Glassfish+Toplink) but that's only because the spec doesn't define exacltly how to handle this. However, that being said, this seems important enough for Hibernate to be able to manage?
--
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
15 years, 3 months
[Hibernate-JIRA] Created: (HHH-3461) Enhance DialectFactory to support Sybase Adaptive Server Anywhere
by Jason Stern (JIRA)
Enhance DialectFactory to support Sybase Adaptive Server Anywhere
-----------------------------------------------------------------
Key: HHH-3461
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3461
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6.GA, Sybase Adaptive Server Anywhere
Reporter: Jason Stern
Priority: Minor
Currently, the org.hibernate.dialect.DialectFactory class has native support for Sybase Adaptive Server Enterprise (ASE), but throws the following exception when used with Sybase Adaptive Server Anywhere (ASA):
"org.hibernate.HibernateException: Hibernate Dialect must be explicitly set for database: Adaptive Server Anywhere"
I have manually set the dialect for now, but if you could add the following line of code to the DialectFactory class, it would help with future portability:
MAPPERS.put( "Adaptive Server Anywhere", new VersionInsensitiveMapper( "org.hibernate.dialect.SybaseAnywhereDialect" ) );
Thanks for all your hard work!
--
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
15 years, 3 months
[Hibernate-JIRA] Created: (HHH-2988) UnionSubclassEntityPersister.generateSubquery() does not use column.getQuotedName()
by benoit heinrich (JIRA)
UnionSubclassEntityPersister.generateSubquery() does not use column.getQuotedName()
-----------------------------------------------------------------------------------
Key: HHH-2988
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2988
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Reporter: benoit heinrich
Priority: Critical
Hi all,
I'm new to hibernate and I'm trying to use the Inheritance strategy TABLE_PER_CLASS with a Postgres database.
The postgres database contains tables and column with upper cases names (names must be quoted).
In the entity I used the back-quote ` sign to quote the table names and column names.
All basic requests work but when I have an association going to the virtual parent table then I got an error due to the fact that the Union subclass entity persister does not quote the column names inside the sub query.
I've locate the problem and I think it occurs here:
org.hibernate.persister.entity.UnionSubclassEntityPersister.java (svn rev. 11398)
line 395 ------------------------------------------------------------------------------------------------
while ( citer.hasNext() ) {
Column col = (Column) citer.next();
if ( !table.containsColumn(col) ) {
int sqlType = col.getSqlTypeCode(mapping);
buf.append( dialect.getSelectClauseNullString(sqlType) )
.append(" as ");
}
buf.append( col.getName() );
buf.append(", ");
But should be ------------------------------------------------------------------------------------------------
buf.append( col.getQuotedName() );
Here is an example to test:
Item.java:
---------------------------------
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Item implements java.io.Serializable {
private long id;
private Container parent;
/** getter / setter */
@Id
@Column(name = "`ID`", unique = true, nullable = false, insertable = true, updatable = true)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "item_id_seq_generator")
@SequenceGenerator(name="item_id_seq_generator", sequenceName="item_id_seq", allocationSize=1)
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
@JoinColumn(name = "`ParentID`", unique = false, nullable = true, insertable = true, updatable = true)
public Container getParent() {
return this.parent;
}
public void setParent(Container parent) {
this.parent = parent;
}
}
Container.java
---------------------------------
@Entity
@Table(name = "`CoNTaiNeR`")
public class Container extends Item {
private Set<Item> items = new HashSet<Item>(0);
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "parent", targetEntity = Item.class)
public Set<Item> getItems() {
return this.items;
}
public void setItems(Set<Item> items) {
this.items = items;
}
}
SimpleItem.java
---------------------------------
@Entity
@Table(name = "`SimpleItem`")
public class SimpleItem extends Item {
/*...*/
}
So when you try to get the Container.getItems() then it generates the wrong query.
Cheers,
/Benoit
--
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
15 years, 3 months
[Hibernate-JIRA] Created: (HSEARCH-218) add indexAll( Class type ) to rebuild indexes from all data
by Sanne Grinovero (JIRA)
add indexAll( Class type ) to rebuild indexes from all data
-----------------------------------------------------------
Key: HSEARCH-218
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-218
Project: Hibernate Search
Issue Type: New Feature
Reporter: Sanne Grinovero
Assignee: Sanne Grinovero
The implementation should be as efficient as possible,
to cover this scenarios:
* Developers change an entity and want to test the effect on the index structure,
they want do to search experiments with the new fields.
* A production system is up(down)graded to a new(old) release,
involving index changes.
(the system is "down for maintenance" but the speed is crucial)
* Existing index is corrupted/lost. (Again, speed to recover is critical)
* A Database backup is restored, or data is changed by other jobs.
* Some crazy developer like me prefers to disable H.Search's event
listeners for some reason.
(I wouldn't generally recommend it, but have met other people who
have a reasonable argument to do this)
* A Lucene update breaks the index format (not so irrationale as they just did on trunk).
--
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
15 years, 3 months
[Hibernate-JIRA] Created: (ANN-684) Query with an IN Clause object that holds an Enum is failing with ORA-01722: invalid number (Criteria) OR ORA-17041: Missing IN or OUT parameter at index (HQL)
by Li Ho (JIRA)
Query with an IN Clause object that holds an Enum is failing with ORA-01722: invalid number (Criteria) OR ORA-17041: Missing IN or OUT parameter at index (HQL)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: ANN-684
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-684
Project: Hibernate Annotations
Issue Type: Bug
Components: search
Affects Versions: 3.2.0.ga
Environment: Hibernate 3.2.0 (cr4)
Oracle
Annotations
Reporter: Li Ho
I am trying to do a query with an IN clause. The object I am passing into the IN clause contains an Enum. I'm not 100% sure, but I think the Enum is causing the problem based on the resulting error message.
When I use the Criteria API, I get the following error:
ORA-01722: invalid number
When I use the equivalent HQL, I get:
ORA-17041: Missing IN or OUT parameter at index
Here is some code (using criteria) that produces the error
List<AccountKey> accountKeys; // AccountKey contains some Strings and an Enum
...
List results = session.createCriteria(MyObject.class).
add(Expression.in("key.account.key", accountKeys)).
list();
The debug SQL looks right... and when I manually try it by replacing the ? params with valid values, it works! So, it seems like there's a problem with the passing of the query parameter values.
I am currently working around this issue by bypassing the object comparison. I extract the variables I want to compare and force it to do a direct String comparison on those elements.
--
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
15 years, 4 months