[Hibernate-JIRA] Commented: (HHH-1804) Empty 'FetchingScrollableResultsImpl' throws SQLException
by Jean-Philippe Grenier (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1804?page=c... ]
Jean-Philippe Grenier commented on HHH-1804:
--------------------------------------------
Issue is still relevant. Thank you
> Empty 'FetchingScrollableResultsImpl' throws SQLException
> ---------------------------------------------------------
>
> Key: HHH-1804
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1804
> Project: Hibernate Core
> Issue Type: Bug
> Reporter: Maarten Winkels
> Attachments: EmptyFetchJoinScrollTest.java, scroll-join-fetch-empty.patch
>
>
> When scrolling a HQL query with join fetch on a collection, that doesn't return any results, the following execption occurs:
> org.hibernate.exception.GenericJDBCException: could not perform sequential read of results (forward)
> at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
> at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
> at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
> at org.hibernate.loader.Loader.loadSequentialRowsForward(Loader.java:386)
> at org.hibernate.impl.FetchingScrollableResultsImpl.next(FetchingScrollableResultsImpl.java:55)
> at org.hibernate.test.joinfetch.EmptyFetchJoinScrollTest.testFetchJoinEmptyScroll(EmptyFetchJoinScrollTest.java:21)
> 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:154)
> at org.hibernate.test.TestCase.runTest(TestCase.java:161)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: java.sql.SQLException: No data is available
> at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
> at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
> at org.hsqldb.jdbc.jdbcResultSet.checkAvailable(Unknown Source)
> at org.hsqldb.jdbc.jdbcResultSet.getColumnInType(Unknown Source)
> at org.hsqldb.jdbc.jdbcResultSet.getString(Unknown Source)
> at org.hsqldb.jdbc.jdbcResultSet.getString(Unknown Source)
> at org.hibernate.type.StringType.get(StringType.java:18)
> at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
> at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
> at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:1088)
> at org.hibernate.loader.Loader.loadSequentialRowsForward(Loader.java:375)
> ... 18 more
--
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, 5 months
[Hibernate-JIRA] Updated: (HHH-1109) composite-key does not support null-values
by Thijs Thiessens (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109?page=c... ]
Thijs Thiessens updated HHH-1109:
---------------------------------
Attachment: componentType-fix-nullkey-compositekey.patch
A quick fix removing the key is null check, thereby allowing null values in primary composite keys
> composite-key does not support null-values
> ------------------------------------------
>
> Key: HHH-1109
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: [org.hibernate.type.EmbeddedComponentType.hydrate(...)#425]
> Reporter: Holger Bartnick
> Attachments: componentType-fix-nullkey-compositekey.patch
>
> Original Estimate: 1 day
> Remaining Estimate: 1 day
>
> At present all legacy data with null-values in its composite-key could not be read properly by hibernate.
> While hibernate processes the resultset it returns null for that record and steps over to the next one.
> Think of a db-view, which combines two (or more) tables by outer-join.
> (that seems only necessary for crude legacy data indeed... but it´s not that unusual as you think)
> The workaround is to use a db-generated identifier for each view-record (ex. combining the nullable-id fields).
> It would be fine, if hibernate is not reliant on that. ;-)
> To allow having composite-keys with partly null-Values, you could think of moving the "unsaved-value"-attribute
> of the "composite-key"-tag to "key-property|key-many-to-one"-Tags...?!
> ---
> Mmmh... saw you´ve done something with "columnNullness" in ver 3.1beta2. Perhaps it is fixed in there...
> also seen on HB-613
--
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, 5 months
[Hibernate-JIRA] Created: (HV-248) Validator should be aware of nested beans
by Ken Egervari (JIRA)
Validator should be aware of nested beans
-----------------------------------------
Key: HV-248
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-248
Project: Hibernate Validator
Issue Type: New Feature
Affects Versions: 4.0.0.CR1
Reporter: Ken Egervari
Priority: Critical
When using the Bean validation listener with Hiberante, I think the property path should be aware of nested beans.
For example, let's say we have a Customer which contains a User object. Both of these objects have validation constraints on them, however, Customer is the top-level one.
Now, if we are to save this Customer bean to hibernate with cascades, and there is an error on the User object on the field 'emailAddress', the constraint's property path is merely 'emailAddress'.
I think this really limits what people can do with the exceptions that you are giving away, as it is very possible that the customer object also has an email address.
I realize you are giving people access to the class and target object, but what if the objects that are contained are the same type?
The right solution to this problem is the give the correct property path. In this case, the property path should really be "user.emailAddress". It should be self-aware that the user was cascaded by the customer object.
I would consider this to be critical, but as it is, it is not easy to get translate the exceptions to the Spring MVC's error handling, which requires the full path (and that makes PERFECT sense in this application).
As it stands, all forms must only edit 1 bean at a time - no components or many-to-one relationships will work.
Thanks for listening
--
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, 5 months
[Hibernate-JIRA] Commented: (HHH-1109) composite-key does not support null-values
by Thijs Thiessens (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109?page=c... ]
Thijs Thiessens commented on HHH-1109:
--------------------------------------
This bug still exists in 3.3.1. Why is the resolution of this issue rejected? Is their any workaround known? Is anyone working on a patch?
> composite-key does not support null-values
> ------------------------------------------
>
> Key: HHH-1109
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1109
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: [org.hibernate.type.EmbeddedComponentType.hydrate(...)#425]
> Reporter: Holger Bartnick
> Original Estimate: 1 day
> Remaining Estimate: 1 day
>
> At present all legacy data with null-values in its composite-key could not be read properly by hibernate.
> While hibernate processes the resultset it returns null for that record and steps over to the next one.
> Think of a db-view, which combines two (or more) tables by outer-join.
> (that seems only necessary for crude legacy data indeed... but it´s not that unusual as you think)
> The workaround is to use a db-generated identifier for each view-record (ex. combining the nullable-id fields).
> It would be fine, if hibernate is not reliant on that. ;-)
> To allow having composite-keys with partly null-Values, you could think of moving the "unsaved-value"-attribute
> of the "composite-key"-tag to "key-property|key-many-to-one"-Tags...?!
> ---
> Mmmh... saw you´ve done something with "columnNullness" in ver 3.1beta2. Perhaps it is fixed in there...
> also seen on HB-613
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-4469) NullPointerException on ManyToMany association at line org.hibernate.type.AbstractType.getHashCode(AbstractType.java:136)
by Sachin Mishra (JIRA)
NullPointerException on ManyToMany association at line org.hibernate.type.AbstractType.getHashCode(AbstractType.java:136)
--------------------------------------------------------------------------------------------------------------------------
Key: HHH-4469
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4469
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: 2009-10-01 13:27:28,062 INFO [org.hibernate.cfg.annotations.Version] - Hibernate Annotations 3.4.0.GA
2009-10-01 13:27:28,078 INFO [org.hibernate.cfg.Environment] - Hibernate 3.3.2.GA
2009-10-01 13:27:28,078 INFO [org.hibernate.cfg.Environment] - hibernate.properties not found
2009-10-01 13:27:28,078 INFO [org.hibernate.cfg.Environment] - Bytecode provider name : javassist
2009-10-01 13:27:28,078 INFO [org.hibernate.cfg.Environment] - using JDK 1.4 java.sql.Timestamp handling
2009-10-01 13:27:28,141 INFO [org.hibernate.annotations.common.Version] - Hibernate Commons Annotations 3.1.0.GA
2009-10-01 13:27:28,141 INFO [org.hibernate.ejb.Version] - Hibernate EntityManager 3.3.1.GA
Reporter: Sachin Mishra
Attachments: hibernate-log.txt
NullPointer Exception gets thrown on manytomany association when using composite key. Following the example from site http://boris.kirzner.info/blog/archives/2008/07/19/hibernate-annotations-...
Loading the product entity correctly loads everything as expected but saving new product record doesn't work when using the composite keys.
Item.java
@Entity
@Table(name="item")
public class Item implements Serializable {
private Integer id;
private String name;
private List<ProductItem> productItems = new LinkedList<ProductItem>();
private static Logger logger = Logger.getLogger(Item.class);
/**
* @return the id
*/
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="item_id")
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the productItems
*/
@OneToMany(fetch=FetchType.LAZY,mappedBy="pk.item",cascade={CascadeType.ALL})
@Cascade({org.hibernate.annotations.CascadeType.ALL})
public List<ProductItem> getProductItems() {
return productItems;
}
/**
* @param productItems the productItems to set
*/
public void setProductItems(List<ProductItem> productItems) {
this.productItems = productItems;
}
@Override
public int hashCode() {
int result;
result = (this.id != null ? id.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Item other = (Item) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
return false;
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
}
Product.java
@Entity
@Table(name="product")
public class Product implements Serializable {
private static Logger logger = Logger.getLogger(Product.class);
private Integer id;
private String name;
private String description;
private double regularPrice;
private List<ProductItem> productItems = new LinkedList<ProductItem>();
/**
* @return the id
*/
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="prod_id")
public Integer getId() {
return id;
}
/**
* @return the name
*/
@Column(name="prod_name")
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the productItems
*/
@OneToMany(fetch=FetchType.LAZY,mappedBy="pk.product",cascade={CascadeType.ALL})
@Cascade({org.hibernate.annotations.CascadeType.ALL})
public List<ProductItem> getProductItems() {
return productItems;
}
/**
* @param productItems the productItems to set
*/
public void setProductItems(List<ProductItem> productItems) {
this.productItems = productItems;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
@Override
public int hashCode() {
int result;
result = (id != null ? id.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Product other = (Product) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
return false;
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
ProductItem.java
@Entity
@Table(name = "productItem")
@AssociationOverrides({
@AssociationOverride(name = "pk.product", joinColumns = @JoinColumn(name = "product_id")),
@AssociationOverride(name = "pk.item", joinColumns = @JoinColumn(name = "item_id"))
})
public class ProductItem implements Serializable{
private static Logger logger = Logger.getLogger(ProductItem.class);
private ProductItemPk pk ;
/**
* @return the item
*/
@Transient
public Item getItem() {
return getPk().getItem();
}
/**
* @param item the item to set
*/
public void setItem(Item item) {
getPk().setItem(item);
}
/**
* @return the Product
*/
@Transient
public Product getProduct() {
return getPk().getProduct();
}
/**
* @param Product the Product to set
*/
public void setProduct(Product Product) {
getPk().setProduct(Product);
}
/**
* @return the pk
*/
@EmbeddedId
public ProductItemPk getPk() {
return pk;
}
/**
* @param pk the pk to set
*/
public void setPk(ProductItemPk pk) {
this.pk = pk;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProductItem that = (ProductItem) o;
if (getPk() != null ? !getPk().equals(that.getPk()) : that.getPk() != null) return false;
return true;
}
@Override
public int hashCode() {
return (getPk() != null ? getPk().hashCode() : 0);
}
ProductItemPk.java
@Embeddable
public class ProductItemPk implements Serializable{
private static Logger logger = Logger.getLogger(ProductItemPk.class);
private Item item;
private Product product;
/**
* @return the item
*/
@ManyToOne(optional=false)
public Item getItem() {
return item;
}
/**
* @param item the item to set
*/
public void setItem(Item item) {
this.item = item;
}
/**
* @return the product
*/
@ManyToOne(optional=false)
public Product getProduct() {
return product;
}
/**
* @param product the product to set
*/
public void setProduct(Product product) {
this.product = product;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProductItemPk that = (ProductItemPk) o;
if (item != null ? !item.equals(that.item) : that.item != null) return false;
if (product != null ? !product.equals(that.product) : that.product != null)
return false;
return true;
}
@Override
public int hashCode() {
logger.error("productitemPK hashcode called");
int result;
result = (item != null ? item.hashCode() : 0);
result = 31 * result + (product != null ? product.hashCode() : 0);
return result;
}
--
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, 5 months
JIRA maintenance
by Steve Ebersole
The Hibernate JIRA will be unavailable starting at 4:00AM CST on
Saturday, October 3 for a scheduled upgrade. I've been told the upgrade
should take 1-2 hours.
--
Steve Ebersole <steve(a)hibernate.org>
Hibernate.org
15 years, 5 months
[Hibernate-JIRA] Created: (HBX-1145) Warning message "The transaction remains active, [..]" at the end of the hbm2java ant task
by Julien Kronegg (JIRA)
Warning message "The transaction remains active, [..]" at the end of the hbm2java ant task
------------------------------------------------------------------------------------------
Key: HBX-1145
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1145
Project: Hibernate Tools
Issue Type: Bug
Components: ant, hbm2java
Affects Versions: 3.2.2
Environment: Hibernate Tools 3.2.2.GA, DB2, Seam 2.1.2.GA/seam-gen, http://anonsvn.jboss.org/repos/hibernate/branches/Branch_3_2/HibernateExt..., http://anonsvn.jboss.org/repos/hibernate/core/trunk/core/src/main/java/or...
Reporter: Julien Kronegg
Priority: Minor
When doing a hbm2java ant task to generate entities from the database, an exception occurs when closing the connection pool if transactions are used.
INFO: cleaning up connection pool: jdbc:db2://192.168.17.12:8801/TES1
org.hibernate.connection.DriverManagerConnectionProvider close
WARNING: problem closing pooled connection
Throwable occured: com.ibm.db2.jcc.b.SqlException: ... java.sql.Connextion.close() requested while a transaction is in progress on the connection.
The transaction remains active, and the connection cannot be closed. ERRORCODE=-4471, SQLSTATE=null
... // obfuscated calls from com.ibm.db2.jcc.b.*
at org.ibm.db2.jcc.b.jb.close(jb.java:1089)
at org.hibernate.connection.DriverManagerConnectionProvider.close(DriverManagerConnectionProvider:175)
at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder:95)
...
at org.hibernate.tool.ant.Hbm2JavaExporterTask.configureExporter(Hbm2JavaExporterTask:43)
This is only a warning and the hbm2java ant task do the Java file generation correctly. However, this warning make think about a problem when generating the entities from the database.
The solution may be to commit/rollback the transaction (if any) before closing the connection pool. This could be done in JDBCBinder.readFromDatabase() or in the DriverManagerConnectionProvider.close() methods.
Workaround:
-----------------
Set the following property in the hibernate properties file used for the ant task:
hibernate.connection.autocommit=true
--
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, 5 months