[Hibernate-JIRA] Created: (HHH-6277) Envers failed to create AUD table with large strings
by Matthew Casperson (JIRA)
Envers failed to create AUD table with large strings
----------------------------------------------------
Key: HHH-6277
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6277
Project: Hibernate Core
Issue Type: Bug
Components: envers
Environment: MySQL, Envers 1.2.2 GA
Reporter: Matthew Casperson
In my application, Envers failed to create a AUD table for an entity that included a large string property (mapped to a TEXT column in MySQL). So the following class failed to generate a AUD table:
package com.redhat.topicindex.entity;
// Generated Apr 19, 2011 6:51:53 AM by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.envers.Audited;
import org.hibernate.validator.Length;
/**
* Help generated by hbm2java
*/
@Entity
@Audited
@Table(name = "Help", catalog = "Topicize")
public class Help implements java.io.Serializable
{
private static final long serialVersionUID = 8247134318338564478L;
private Integer helpId;
private String tableColId;
private String helpText;
public Help() {
}
public Help(String tableColId, String helpText) {
this.tableColId = tableColId;
this.helpText = helpText;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "HelpID", unique = true, nullable = false)
public Integer getHelpId() {
return this.helpId;
}
public void setHelpId(Integer helpId) {
this.helpId = helpId;
}
@Column(name = "TableColID", length = 512)
@Length(max = 512)
public String getTableColId() {
return this.tableColId;
}
public void setTableColId(String tableColId) {
this.tableColId = tableColId;
}
@Column(name = "HelpText", length = 65535)
@Length(max = 65535)
public String getHelpText() {
return this.helpText;
}
public void setHelpText(String helpText) {
this.helpText = helpText;
}
}
Once the HelpText property was modified, the AUD table was created:
package com.redhat.topicindex.entity;
// Generated Apr 19, 2011 6:51:53 AM by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.envers.Audited;
import org.hibernate.validator.Length;
/**
* Help generated by hbm2java
*/
@Entity
@Audited
@Table(name = "Help", catalog = "Topicize")
public class Help implements java.io.Serializable
{
private static final long serialVersionUID = 8247134318338564478L;
private Integer helpId;
private String tableColId;
private String helpText;
public Help() {
}
public Help(String tableColId, String helpText) {
this.tableColId = tableColId;
this.helpText = helpText;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "HelpID", unique = true, nullable = false)
public Integer getHelpId() {
return this.helpId;
}
public void setHelpId(Integer helpId) {
this.helpId = helpId;
}
@Column(name = "TableColID", length = 512)
@Length(max = 512)
public String getTableColId() {
return this.tableColId;
}
public void setTableColId(String tableColId) {
this.tableColId = tableColId;
}
@Column(name = "HelpText", length = 2048)
@Length(max = 2048)
public String getHelpText() {
return this.helpText;
}
public void setHelpText(String helpText) {
this.helpText = helpText;
}
}
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-4956) Native Query returns wrong results
by Akashdeep Saddi (JIRA)
Native Query returns wrong results
----------------------------------
Key: HHH-4956
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4956
Project: Hibernate Core
Issue Type: Bug
Components: query-sql
Affects Versions: 3.3.2
Environment: hibernate 3.3.2.GA , linux, oracle 10g, weblogic 10
Reporter: Akashdeep Saddi
Issue: In-case running native queries vai hibernate we have two technical ID's in the select clause from join of two or more tables the value of all the id's is set to one value.
Example
A.id = 1
B.id =2
select A.Id as A_ID, B.Id as B_ID from A, B where A.B_id = B.id will return 1,1 in the result instead of 1,2
Resolution: Use Alias in-case more than one technical keys are part of select clause. Above query works fine when changed as below
select A.Id , B.Id from A, B where A.B_id = B.id will return 1,2
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-6270) AliasToBeanResultTransformer behaves differenty if you call the list() or the scroll() method on an SQLQuery object
by Filippo Machi (JIRA)
AliasToBeanResultTransformer behaves differenty if you call the list() or the scroll() method on an SQLQuery object
-------------------------------------------------------------------------------------------------------------------
Key: HHH-6270
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6270
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.4
Environment: 3.6.4
postgres 9
Reporter: Filippo Machi
Executing an sql query using the SQLQuery class, in particular using createSQLQuery(..) method and setting a transformer, in particular an AliasToBeanResultTransformer I noticed that the obtained beans are different if you use the scroll() or the list() method: using scroll() beans are not filled as expected.
Consider the following excerpts, the former uses the list() method the latter the scroll() one on the same SQLQuery object, nothing else changes.
----- LIST -----
SQLQuery query = session.createSQLQuery("select website, category, name, country,.....");
query.setResultTransformer(Transformers.aliasToBean(Crawler.class));
List<Crawler> result = query.list();
for(Crawler row:result) {
System.out.println(row.toString());
}
----- SCROLL ----
SQLQueryImpl query = (SQLQueryImpl)session.createSQLQuery("select website, category, name, country,.....");
query.setResultTransformer(Transformers.aliasToBean(Crawler.class));
ScrollableResultsImpl result = (ScrollableResultsImpl) query.scroll();
while(result.next()) {
Object[] obj = result.get();
// in this case the object is an empty crawler class
}
Consider that the Crawler class isn't an entity and it holds values coming out from a complex query.
Debugging I saw that performing a list(), in the CustomLoader, the HolderInstantiator object that wraps the result transformer and the column aliases it uses is built after the autodiscovery phase, so it take advantages of it, providing the right aliases (a filled list of column aliases) to the transformer. And in this case beans are succesfully filled.
On the contrary, invoking the scroll() method, the HolderInstantiator is built before accessing the result set
and the autodiscovery phase, so there are no aliases.
In this case the transformer is invoked without providing any column alias.
These two behaviours are not coherent among each other to 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
13 years, 7 months