[Hibernate-JIRA] Created: (HHH-6066) Postgresql can not work with @Lob type
by Steve Ni (JIRA)
Postgresql can not work with @Lob type
--------------------------------------
Key: HHH-6066
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6066
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.6.1
Environment: Postgresql 8.x and JDBC driver 9.0-801.jdbc4
Reporter: Steve Ni
My application needs compatible with some major database such as Oracle, Mysql and Postgresql. I also use hibernatetool ant task to generate DDL. I use @Type(type="text") for string. Before 3.5 version, everything is OK. However, after 3.5 Oracel uses long instead clob type. As Long is deprecated type and the Oracle JDBC driver also has bug to read Long type with hibernate (Stream closed exception). So I try to use @Lob replaces @Type(type=text). The problem is this annotation doesn't work with postgresql.
Regarding to this issue, I did some research. The better fix could be Oracle use clob instead of Long. There is not good reason use deprecated type...
Here is exception:
org.springframework.dao.DataIntegrityViolationException: could not load an entity: [com.edgenius.core.model.Configuration#7]; nested exception is org.hibernate.exception.DataException: could not load an entity: [com.edgenius.core.model.Configuration#7]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:639)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:921)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:917)
at com.edgenius.core.dao.hibernate.UserDAOHibernate.getUserByName(UserDAOHibernate.java:145)
at com.edgenius.core.dao.hibernate.UserDAOHibernate.loadUserByUsername(UserDAOHibernate.java:192)
at com.edgenius.wiki.security.acegi.TokenBasedRememberMeServices.processAutoLoginCookie(TokenBasedRememberMeServices.java:67)
at org.springframework.security.ui.rememberme.AbstractRememberMeServices.autoLogin(AbstractRememberMeServices.java:85)
at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:74)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at com.edgenius.wiki.security.acegi.CaptchaValidationProcessingFilter.doFilter(CaptchaValidationProcessingFilter.java:76)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.edgenius.core.webapp.filter.LocaleFilter.doFilterInternal(LocaleFilter.java:147)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.edgenius.wiki.webapp.filter.InstallFilter.doFilterInternal(InstallFilter.java:50)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.hibernate.exception.DataException: could not load an entity: [com.edgenius.core.model.Configuration#7]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.loadEntity(Loader.java:2041)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3293)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1038)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:630)
at org.hibernate.type.EntityType.resolve(EntityType.java:438)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:982)
at org.hibernate.loader.Loader.doQuery(Loader.java:857)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2533)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:930)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
... 51 more
Caused by: org.postgresql.util.PSQLException: Bad value for type long
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toLong(AbstractJdbc2ResultSet.java:2796)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getLong(AbstractJdbc2ResultSet.java:2019)
at org.postgresql.jdbc4.Jdbc4ResultSet.getClob(Jdbc4ResultSet.java:43)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getClob(AbstractJdbc2ResultSet.java:384)
at org.apache.commons.dbcp.DelegatingResultSet.getClob(DelegatingResultSet.java:568)
at org.apache.commons.dbcp.DelegatingResultSet.getClob(DelegatingResultSet.java:568)
at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$4.doExtract(ClobTypeDescriptor.java:104)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:249)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:229)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:330)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
at org.hibernate.loader.Loader.getRow(Loader.java:1355)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
at org.hibernate.loader.Loader.doQuery(Loader.java:829)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
--
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
12 years, 3 months
[Hibernate-JIRA] Created: (HHH-5585) SubDialect of PostgreSQLDialect to support (@Lob + byte[]) combination
by Justin Sands (JIRA)
SubDialect of PostgreSQLDialect to support (@Lob + byte[]) combination
----------------------------------------------------------------------
Key: HHH-5585
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5585
Project: Hibernate Core
Issue Type: Patch
Environment: 3.6.0.CR1, postgresql
Reporter: Justin Sands
Attachments: CustomPostgreSQLDialect.zip
>From hibernate 3.5 to 3.6 the annotation combination @Lob + byte[] does not on postgresql work due to idiosyncrasies in the postgresql JDBC driver.
To support this combination, the following dialect variant can be used along with a basic-type override, provided that the application consistently uses the same annotation style (@Lob + byte[]). A similar approach could be used to support using the OID blob type which postgresql provides, although this patch does not address it.
The user must register the basic type override MateralizedVarBinaryBlobType at boot time.
I am unsure exactly where in the distribution this would fit so I have kept it in one package (org.hibernate.dialect.variant).
I have test cases which I could detach from my current project, if the maintainers think this patch is worth including.
--
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
12 years, 3 months
[Hibernate-JIRA] Created: (HHH-6433) PostCommitListeners are called during rollback
by Shawn Clowater (JIRA)
PostCommitListeners are called during rollback
----------------------------------------------
Key: HHH-6433
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6433
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.2
Environment: JDK 1.6u25, Win7, Oracle10
Reporter: Shawn Clowater
EntityActions that are registered as part of transaction completion are still called when the transaction didn't succeed.
As an example, the DeleteEntityAction
{code}
public void doAfterTransactionCompletion(boolean success, SessionImplementor session) throws HibernateException {
if ( getPersister().hasCache() ) {
final CacheKey ck = new CacheKey(
getId(),
getPersister().getIdentifierType(),
getPersister().getRootEntityName(),
getSession().getEntityMode(),
getSession().getFactory()
);
getPersister().getCacheAccessStrategy().unlockItem( ck, lock );
}
postCommitDelete();
}
{code}
The success is false in the event of a rollback so it doesn't update the cache but it still calls the postCommitDelete which triggers the postCommitDelete listeners. I would think this should only occur in the event that the transaction was actually committed.
To add insult to injury the ActionQueue will also add failed actions to the after transaction completion queue and invalidate the query spaces.
{code}
public void execute(Executable executable) {
try {
executable.execute();
}
finally {
registerCleanupActions( executable );
}
}
private void registerCleanupActions(Executable executable) {
beforeTransactionProcesses.register( executable.getBeforeTransactionCompletionProcess() );
if ( session.getFactory().getSettings().isQueryCacheEnabled() ) {
final String[] spaces = (String[]) executable.getPropertySpaces();
afterTransactionProcesses.addSpacesToInvalidate( spaces );
session.getFactory().getUpdateTimestampsCache().preinvalidate( spaces );
}
afterTransactionProcesses.register( executable.getAfterTransactionCompletionProcess() );
}
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 3 months
[Hibernate-JIRA] Created: (HHH-6429) GROUP BY clause doesn't work with composite objects
by Fernando Santos (JIRA)
GROUP BY clause doesn't work with composite objects
---------------------------------------------------
Key: HHH-6429
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6429
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.6.5
Environment: Firebird 2.1 Server, Hibernate 3.6.5, java 6, eclipse IDE
Reporter: Fernando Santos
Priority: Critical
I'm trying to run the HQL below in the latest hibernate version
{quote}
SELECT
m.account,
(SELECT sum(amount) from Movement where date > '20-02-2011') as primo
FROM
Movement m
GROUP BY
m.account
{quote}
The problem is when the HQL is parsed, the account fields are added to my SELECT query but not to my GROUP BY query like below. Has someone been faced the same problem?
Generated SQL:
{quote}
select movement0_.MOV_ACCOUNT_NUMBER as col_0_0_,
movement0_.MOV_ACCOUNT_AFDELING_ID as col_0_1_,
(select sum(movement2_.MOV_AMOUNT) from MOVEMENT movement2_) as col_1_0_,
account1_.KONTONR as KONTONR12_,
account1_.AFDELING_ID as AFDELING14_12_,
account1_.KON_FUNCTION as KON2_12_,
account1_.KON_BALANCE as KON3_12_,
account1_.KON_BLOCKED as KON4_12_,
account1_.KONTO_NAVN as KONTO5_12_,
account1_.KON_KEY_FIGURE_CODE as KON6_12_,
account1_.KON_MONITORED as KON7_12_,
account1_.KON_SUGGEST_CONTRA_ACC as KON8_12_,
account1_.KON_TOTALFROM as KON9_12_,
account1_.KON_TYPE as KON10_12_,
account1_.UAFD_GRP_NAVN as UAFD11_12_,
account1_.UAFD_NAVN as UAFD12_12_,
account1_.KON_TAX as KON15_12_,
account1_.OPTLOCK as OPTLOCK12_
from MOVEMENT movement0_
inner join KONTOPLAN account1_
on movement0_.MOV_ACCOUNT_NUMBER=account1_.KONTONR
and movement0_.MOV_ACCOUNT_AFDELING_ID=account1_.AFDELING_ID
group by
movement0_.MOV_ACCOUNT_NUMBER,
movement0_.MOV_ACCOUNT_AFDELING_ID
{quote}
Error
{quote}
Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause)
{quote}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 3 months