[Hibernate-JIRA] Commented: (HHH-1573) one-to-many fails on oracle if field starts with underscore
by Marco Reimann (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1573?page=c... ]
Marco Reimann commented on HHH-1573:
------------------------------------
I just noticed that the leading underscore problem was fixed under the bug id HHH-2022 in 3.2.0-cr4. I ran my testcase against the new 3.2.1-ga version and it worked out of the box. So this bug could also be considered as fixed.
> one-to-many fails on oracle if field starts with underscore
> -----------------------------------------------------------
>
> Key: HHH-1573
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1573
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.2
> Reporter: Stephen Friedrich
> Attachments: leadingunderscore.zip, org.hibernate.util.StringHelper.patch
>
>
> Hibernate generates SQL that is invalid on Oracle, because it has fields in the select clause that start with an underscore.
> This is my field declaration:
> @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "_user")
> private Set<Permission> _permissions = new HashSet<Permission>();
> And this is the generated SQL:
> select
> _permissio0_.user_id as user4_2_,
> _permissio0_.id as id2_,
> _permissio0_.id as id40_1_,
> _permissio0_.version as version40_1_,
> _permissio0_.guid as guid40_1_,
> _permissio0_.user_id as user4_40_1_,
> _permissio0_2_.company_reference_id as company2_42_1_,
> case
> when _permissio0_1_.permission_id is not null then 1
> when _permissio0_2_.permission_id is not null then 2
> when _permissio0_.id is not null then 0
> end
> as
> clazz_1_,
> companyref1_.id as id43_0_,
> companyref1_.version as version43_0_,
> companyref1_.guid as guid43_0_,
> companyref1_.db_user_name as db4_43_0_,
> companyref1_.company_name as company5_43_0_
> from
> permissions _permissio0_
> left outer join admin_permissions _permissio0_1_ on _permissio0_.id=_permissio0_1_.permission_id
> left outer join company_permissions _permissio0_2_ on _permissio0_.id=_permissio0_2_.permission_id
> left outer join company_references companyref1_ on _permissio0_2_.company_reference_id=companyref1_.id
> where _permissio0_.user_id=?
> When executed Oracle gives this error: "ORA-00911: Ung³ltiges Zeichen" ("invalid character" in german)
> If I remove the underscore in front of every occurence of "_permissio..." then I can execute the SQL fine on the command line ("?" replaced by 1).
> This has been reported on the forum, but nobody answered. See last post in
> http://forums.hibernate.org/viewtopic.php?t=929011&highlight=ora00911&sid...
--
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
18 years
[Hibernate-JIRA] Commented: (ANN-391) SecondaryTables not recognized when using JOINED inheritance
by Alec Lanter (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-391?page=co... ]
Alec Lanter commented on ANN-391:
---------------------------------
This issue is not fixed by HHH-2053. The issue described above is one I'm currently facing with Hibernate Core 3.2.1, and Hibernate Annotations 3.2.0, and is specific to annotations. The mapping described was implemented with XML configuration files nearly six months ago at the company where I work, but our attempts to move to annotated classes are currently halted due to this bug with @SecondaryTable and subclasses.
> SecondaryTables not recognized when using JOINED inheritance
> ------------------------------------------------------------
>
> Key: ANN-391
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-391
> Project: Hibernate Annotations
> Type: Bug
> Versions: 3.1.0.Beta10, 3.2.0.cr1
> Environment: Hibernate 3.2.0CR1; db is irrelevant, as the buildSessionFactory() fails.
> Reporter: Sebastian Kirsch
> Attachments: TestSecondaries.java, TestSecondaries.java
>
>
> The Configuration doesn't recognize secondary tables of a super class.
> Calling AnnotationConfiguration.buildSessionFactory fails, claiming that the secondary table used in the super class cannot be found in the subclass.
> Adding the secondary table to the subclass doesn't help either.
> See attached JUnit test case.
--
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
18 years
[Hibernate-JIRA] Commented: (HHH-1737) Add a ConnectionWrapper interface to allow access to the underlying connection from a BorrowedConnectionProxy
by Adrian Riley (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1737?page=c... ]
Adrian Riley commented on HHH-1737:
-----------------------------------
Yes, sorry, I realised that after posting. Thanks
> Add a ConnectionWrapper interface to allow access to the underlying connection from a BorrowedConnectionProxy
> -------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1737
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1737
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.1, 3.1.2, 3.1.3
> Environment: Hibernate 3.1.3, Oracle 9.2.0.4
> Reporter: Nick Reid
> Assignee: Steve Ebersole
> Fix For: 3.2.1
>
>
> The borrowConnection functionality now prevents us from accessing the native connection to perform necessary operations (LOB handling, OAQ integration). Instead of just returning a simple proxy the implements java.sql.Connection the proxy could additionally implement an interface that allows users to access the wrapped connection returned by the ConnectionManager.
> i.e.
> public interface BorrowedConnection extends java.sql.Connection
> {
> java.sql.Connection getTargetConnection()
> }
> public class BorrowedConnectionProxy implements InvocationHandler {
> private final ConnectionManager connectionManager;
> private boolean useable = true;
> public BorrowedConnectionProxy(ConnectionManager connectionManager) {
> this.connectionManager = connectionManager;
> }
> public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
> if ( "close".equals( method.getName() ) ) {
> connectionManager.releaseBorrowedConnection();
> return null;
> }
> if ( "getTargetConnection".equals( method.getName() ) ) {
> return connectionManager.getConnection();
> }
> // should probably no-op commit/rollback here, at least in JTA scenarios
> if ( !useable ) {
> throw new HibernateException( "connnection proxy not usable after transaction completion" );
> }
> try {
> return method.invoke( connectionManager.getConnection(), args );
> }
> catch( InvocationTargetException e ) {
> throw e.getTargetException();
> }
> }
> public static Connection generateProxy(ConnectionManager connectionManager) {
> BorrowedConnectionProxy handler = new BorrowedConnectionProxy( connectionManager );
> return ( Connection ) Proxy.newProxyInstance(
> Connection.class.getClassLoader(),
> new Class[] { BorrowedConnection.class },
> handler
> );
> }
> public static void renderUnuseable(Connection connection) {
> if ( connection != null && Proxy.isProxyClass( connection.getClass() ) ) {
> InvocationHandler handler = Proxy.getInvocationHandler( connection );
> if ( BorrowedConnectionProxy.class.isAssignableFrom( handler.getClass() ) ) {
> ( ( BorrowedConnectionProxy ) handler ).useable = false;
> }
> }
> }
> }
> We could always get access to the connectionManager field of the invocation handler via reflection, but this is not supportable or maintainable.
--
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
18 years
[Hibernate-JIRA] Commented: (HHH-1737) Add a ConnectionWrapper interface to allow access to the underlying connection from a BorrowedConnectionProxy
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1737?page=c... ]
Steve Ebersole commented on HHH-1737:
-------------------------------------
Of course its "working" when using C3P0; at least this is the same behavior Hibernate always exhibited here. The wrapped connection, from Hibernate's perspective, is the C3P0 wrapped connection (C3P0 defines this NewProxyConnection, not HIbernate).
> Add a ConnectionWrapper interface to allow access to the underlying connection from a BorrowedConnectionProxy
> -------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1737
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1737
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.1, 3.1.2, 3.1.3
> Environment: Hibernate 3.1.3, Oracle 9.2.0.4
> Reporter: Nick Reid
> Assignee: Steve Ebersole
> Fix For: 3.2.1
>
>
> The borrowConnection functionality now prevents us from accessing the native connection to perform necessary operations (LOB handling, OAQ integration). Instead of just returning a simple proxy the implements java.sql.Connection the proxy could additionally implement an interface that allows users to access the wrapped connection returned by the ConnectionManager.
> i.e.
> public interface BorrowedConnection extends java.sql.Connection
> {
> java.sql.Connection getTargetConnection()
> }
> public class BorrowedConnectionProxy implements InvocationHandler {
> private final ConnectionManager connectionManager;
> private boolean useable = true;
> public BorrowedConnectionProxy(ConnectionManager connectionManager) {
> this.connectionManager = connectionManager;
> }
> public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
> if ( "close".equals( method.getName() ) ) {
> connectionManager.releaseBorrowedConnection();
> return null;
> }
> if ( "getTargetConnection".equals( method.getName() ) ) {
> return connectionManager.getConnection();
> }
> // should probably no-op commit/rollback here, at least in JTA scenarios
> if ( !useable ) {
> throw new HibernateException( "connnection proxy not usable after transaction completion" );
> }
> try {
> return method.invoke( connectionManager.getConnection(), args );
> }
> catch( InvocationTargetException e ) {
> throw e.getTargetException();
> }
> }
> public static Connection generateProxy(ConnectionManager connectionManager) {
> BorrowedConnectionProxy handler = new BorrowedConnectionProxy( connectionManager );
> return ( Connection ) Proxy.newProxyInstance(
> Connection.class.getClassLoader(),
> new Class[] { BorrowedConnection.class },
> handler
> );
> }
> public static void renderUnuseable(Connection connection) {
> if ( connection != null && Proxy.isProxyClass( connection.getClass() ) ) {
> InvocationHandler handler = Proxy.getInvocationHandler( connection );
> if ( BorrowedConnectionProxy.class.isAssignableFrom( handler.getClass() ) ) {
> ( ( BorrowedConnectionProxy ) handler ).useable = false;
> }
> }
> }
> }
> We could always get access to the connectionManager field of the invocation handler via reflection, but this is not supportable or maintainable.
--
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
18 years
[Hibernate-JIRA] Commented: (HHH-1737) Add a ConnectionWrapper interface to allow access to the underlying connection from a BorrowedConnectionProxy
by Adrian Riley (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1737?page=c... ]
Adrian Riley commented on HHH-1737:
-----------------------------------
Sorry, of course it does work when using the built in JDBC connection pool, but not when using C3P0.
> Add a ConnectionWrapper interface to allow access to the underlying connection from a BorrowedConnectionProxy
> -------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1737
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1737
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.1, 3.1.2, 3.1.3
> Environment: Hibernate 3.1.3, Oracle 9.2.0.4
> Reporter: Nick Reid
> Assignee: Steve Ebersole
> Fix For: 3.2.1
>
>
> The borrowConnection functionality now prevents us from accessing the native connection to perform necessary operations (LOB handling, OAQ integration). Instead of just returning a simple proxy the implements java.sql.Connection the proxy could additionally implement an interface that allows users to access the wrapped connection returned by the ConnectionManager.
> i.e.
> public interface BorrowedConnection extends java.sql.Connection
> {
> java.sql.Connection getTargetConnection()
> }
> public class BorrowedConnectionProxy implements InvocationHandler {
> private final ConnectionManager connectionManager;
> private boolean useable = true;
> public BorrowedConnectionProxy(ConnectionManager connectionManager) {
> this.connectionManager = connectionManager;
> }
> public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
> if ( "close".equals( method.getName() ) ) {
> connectionManager.releaseBorrowedConnection();
> return null;
> }
> if ( "getTargetConnection".equals( method.getName() ) ) {
> return connectionManager.getConnection();
> }
> // should probably no-op commit/rollback here, at least in JTA scenarios
> if ( !useable ) {
> throw new HibernateException( "connnection proxy not usable after transaction completion" );
> }
> try {
> return method.invoke( connectionManager.getConnection(), args );
> }
> catch( InvocationTargetException e ) {
> throw e.getTargetException();
> }
> }
> public static Connection generateProxy(ConnectionManager connectionManager) {
> BorrowedConnectionProxy handler = new BorrowedConnectionProxy( connectionManager );
> return ( Connection ) Proxy.newProxyInstance(
> Connection.class.getClassLoader(),
> new Class[] { BorrowedConnection.class },
> handler
> );
> }
> public static void renderUnuseable(Connection connection) {
> if ( connection != null && Proxy.isProxyClass( connection.getClass() ) ) {
> InvocationHandler handler = Proxy.getInvocationHandler( connection );
> if ( BorrowedConnectionProxy.class.isAssignableFrom( handler.getClass() ) ) {
> ( ( BorrowedConnectionProxy ) handler ).useable = false;
> }
> }
> }
> }
> We could always get access to the connectionManager field of the invocation handler via reflection, but this is not supportable or maintainable.
--
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
18 years