SybaseASE15Dialect getMaxAliasLength() cause SQL exception

Description

After upgrade Hibernate from 3.2.0 to 3.6.0, I got following exception with following SQL (converted from HQL):

select defaultwdo1_.displayDescriptionTemplate as displayDescriptionTemplate30_1_ from WJob wjob0_, WDocDist defaultwdo1_

Caused by: com.sybase.jdbc3.jdbc.SybSQLException: The identifier that starts with 'displayDescriptionTemplate30_1' is too long. Maximum length is 30.

at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(Unknown Source)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeQuery(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)

The same SQL can be executed in native Sybase ISQL environment without any error.

The workaround using Sybase11Dilect or modify getMaxAliasLength() inside SybaseASE15Dialect to return a smaller number(e.g. 20)

Environment

Sybase ASE 15.5 with Sybase JDBC 3 (jconn3.jar)
Hibernate 3.6.0 final
JDK 1.6.0_23

Activity

Show:
Chris Cranford
January 10, 2019, 6:44 PM
Edited

We blogged about 6.0 Alpha1 about one month ago. You can find details using the following link:
http://in.relation.to/2018/12/06/hibernate-orm-600-alpha1-out/

I want to stress that this is an alpha and not every feature that works under 5.x will work under this build just yet. A number of internal systems were overhauled to address the needs and goals of the new release and we're actively working on fixing those gaps where they currently exist. You guys are welcomed to check it out and demo it and give us feedback on what you find. We're aware there are shortcomings, a lot of which is covered in several ascii doc files in the wip/6.0 branch of the repository.

Guillaume Smet
March 21, 2019, 6:24 PM

We have a tentative PR here: https://github.com/hibernate/hibernate-orm/pull/2666 but CI is failing.

Kai Hackemesser
March 26, 2019, 11:55 PM

@Gail Badner this needs to be included into V5 build, not V6. In V6 aliases are no longer used (yay) and the patch becomes obsolete.

Gail Badner
March 27, 2019, 12:24 AM

, yes, you're correct. I forgot about that.

As said in a PR comment:

"This issue is quite old so it affects all versions of Hibernate, not just 5.4.

If the issue is really important for you, you could try to enhance it so that all tests pass. Anyway, modifying the Column alone is not enough. The aliases used during JPQL parsing is not covered by this PR. So, there's more work to be done to fix this propertly."

We (the Hibernate team) have no plans to fix this, since it will be obsolete in Hibernate 6. If someone creates a PR with a fix, and that fix is not too risky, then we will consider getting it fixed in 5.4.

Assignee

Unassigned

Reporter

Yang Li

Fix versions

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Critical
Configure