[Hibernate-JIRA] Created: (HHH-5858) Cannot load entities with Clob or Lob properties into stateless sessions
by James Roper (JIRA)
Cannot load entities with Clob or Lob properties into stateless sessions
------------------------------------------------------------------------
Key: HHH-5858
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5858
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.1
Reporter: James Roper
I have a an entity with a Clob property:
{code:java}
@Lob
private Clob clobProperty;
{code}
When I try and load it in a stateless session, I get:
{noformat}
Exception in thread "main" java.lang.ClassCastException: org.hibernate.impl.StatelessSessionImpl cannot be cast to org.hibernate.engine.jdbc.LobCreationContext
at org.hibernate.Hibernate.getLobCreator(Hibernate.java:420)
at org.hibernate.type.ClobType.nullSafeGet(ClobType.java:114)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2267)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1423)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1351)
at org.hibernate.loader.Loader.getRow(Loader.java:1251)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:619)
at org.hibernate.loader.Loader.loadSingleRow(Loader.java:307)
at org.hibernate.impl.ScrollableResultsImpl.prepareCurrentRow(ScrollableResultsImpl.java:254)
at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:123)
{noformat}
If Lobs in stateless sessions isn't supported, then at very least an error message to that effect should be thrown and the docs should be updated to reflect this, but I don't see why that should be the case, especially considering that both Lobs and stateless session both serve very similar purposes, they are for use when dealing with large datasets that may not fit in memory, and so could well be used together.
--
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, 12 months
[Hibernate-JIRA] Created: (HHH-4808) SessionImpl.initializeCollection() does not release JDBC connection (if outside of a transaction)
by Martin Renner (JIRA)
SessionImpl.initializeCollection() does not release JDBC connection (if outside of a transaction)
-------------------------------------------------------------------------------------------------
Key: HHH-4808
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4808
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2, 3.2.7
Reporter: Martin Renner
Priority: Critical
With {{ConnectionReleaseMode.AFTER_TRANSACTION}} (the default), Hibernate does not release the JDBC connection when resolving a lazily loaded collection, if this happens *outside* of an active transaction.
First, I will describe, what happens if Hibernate executes a query outside of a transaction. Then I will describe how lazy collection loading behaves differently.
When the method {{list}} of a query ({{QueryImpl.java}}) is getting called, Hibernate delegates to {{SessionImpl.list()}}. After having loaded the list, {{SessionImpl.list()}} calls {{SessionImpl.afterOperation()}}, which calls {{jdbcContext.afterNontransactionalQuery()}} (as there is no active transaction). This leads to {{ConnectionManager.afterTransaction()}} which releases the JDBC connection. This is exactly what I expect to happen.
Now to the lazily loaded collection:
{{Hibernate.initialize(collection)}} and {{person.getPets().size()}} both end up in {{SessionImpl.initializeCollection()}}. This call gets dispatched down to {{Loader.doQueryAndInitializeNonLazyCollections()}} and {{Loader.doQuery()}}. The important fact is, that {{ConnectionManager.afterTransaction()}} never gets called (like in the query-example above).
The result is, that the JDBC connection is not released.
IMHO resolving of a lazily loaded collection should behave like executing a query. {{SessionImpl.initializeCollection()}} should call {{SessionImpl.afterOperation()}} in the same way as {{SessionImpl.list()}} is doing this.
I will attach a small demo application which shows the difference (concerning {{ConnectionManager}}) between queries and collections.
--
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, 12 months
[Hibernate-JIRA] Created: (HV-554) Regular Expression for @Email
by William Hardwick (JIRA)
Regular Expression for @Email
------------------------------
Key: HV-554
URL: https://hibernate.onjira.com/browse/HV-554
Project: Hibernate Validator
Issue Type: Improvement
Components: validators
Affects Versions: 4.2.0.Final
Reporter: William Hardwick
Priority: Minor
It would be nice if @Email allowed for a regular expression like @URL does. For example, we wanted to restrict emails to external addresses only (i.e. ending in .com, .net, etc.), but the @Email validation allows internal addresses as well, for example bob@mycompany instead of bob(a)mycompany.com. We had to write our own custom validation to handle this.
@Email(regexp="myRegexp")
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 12 months