[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, 2 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, 2 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, 2 months
[Hibernate-JIRA] Created: (HHH-3161) No Dialect mapping for JDBC type: -4
by cyrus (JIRA)
No Dialect mapping for JDBC type: -4
------------------------------------
Key: HHH-3161
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3161
Project: Hibernate3
Issue Type: Bug
Components: core, query-hql, query-sql
Affects Versions: 3.2.1
Environment: hibernate 3.2.1 + mysql
Reporter: cyrus
Priority: Critical
When I execute the statement below:
SELECT concat(case ip_protocol when 6 then 'TCP' when 17 then 'UDP' else 'OTHER' end, ', PORT ', repeat(' ', 5 - length(if(port is NULL, 0, port))), if(port is NULL, 0, port)) as protocol, concat(case ip_protocol when 6 then 'TCP' when 17 then 'UDP' else 'OTHER' end, if(port is NULL, 0, port)) as id, sum(byte_subtotal) as total FROM usage_sum_minute WHERE from_unixtime(time_min * 60) between '2008-02-03 14:00:00' and '2008-03-05 13:59:00' GROUP BY protocol ORDER BY total DESC LIMIT 0, 20
DB schema:
CREATE TABLE `ascot`.`usage_sum_minute` (
`id` int(11) NOT NULL auto_increment,
`igateway_id` smallint(5) NOT NULL,
`time_min` int(11) NOT NULL,
`user_name` varchar(255) default NULL,
`mac_local` varchar(80) NOT NULL,
`ip_local` bigint(20) NOT NULL,
`ip_remote` bigint(20) NOT NULL,
`ip_protocol` smallint(5) NOT NULL,
`port` smallint(6) default NULL,
`domain_name` char(80) default NULL,
`url` varchar(1024) default NULL,
`byte_subtotal` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
KEY `index_igateway` (`igateway_id`),
KEY `index_protocol` (`ip_protocol`),
KEY `index_minute` (`time_min`),
KEY `index_user` (`user_name`),
KEY `index_port` (`port`),
KEY `index_ip` (`ip_remote`)
) ENGINE=InnoDB AUTO_INCREMENT=505699 DEFAULT CHARSET=latin1
It give an exception "No Dialect mapping for JDBC type: -4"
--
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, 2 months