[Hibernate-JIRA] Commented: (HHH-1501) insert long string (more than 32700) fails on derby
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501?page=c... ]
Steve Ebersole commented on HHH-1501:
-------------------------------------
{quote}
I should be able to declare a byte[] field in Java and Hibernate should figure out how to map that to various databases.
{quote}
Its not a question of "various databases". Its a question of "various JDBC types". And that part we have done. That is why there is a StringType (String->VARCHAR), a MaterializedClobType (String->CLOB), etc. All you have told Hibernate is "I have a String". Again, short of querying the JDBC metadata for that column (which will not happen, see previous comment) how are you thinking HIbernate is supposed to know that this particular String property is a CLOB while some other property is a VARCHAR?
Why is it soooooo unreasonable that you tell it "hey, use your super-duper 'materialized_clob' type for this particular property"?
> insert long string (more than 32700) fails on derby
> ---------------------------------------------------
>
> Key: HHH-1501
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.5.0-Beta-2
> Environment: Derby 10
> Reporter: Sergey Vladimirov
> Priority: Trivial
>
> http://issues.apache.org/jira/browse/DERBY-102
> VARCHAR maximum length 32 672
> LONG VARCHAR maximum length 32 700
> CLOB maximum length 2 147 483 647
> BLOB maximum length 2 147 483 647
> this issue can be reproduced by org.hibernate.test.lob.TextTest (in 3.5 beta1,2) with change org.hibernate.test.lob.LongStringTest.LONG_STRING_SIZE > 32700
--
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
14 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1501) insert long string (more than 32700) fails on derby
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501?page=c... ]
Steve Ebersole commented on HHH-1501:
-------------------------------------
Sergey, attitude like that is not going to get you help.
Guys, so look at it like this. Lets take the String case (the byte[] is really the same). So you tell Hibernate to map this property as a String. In the absence of you telling it anything else it needs to determine the proper database type (well techincally the JDBC type). What you both are asking is that it do some form of database look up to make this determination (you may not now it, but that is in fact what you are asking). That is not reasonable, imho, when Hibernate already provides means for y'all to tell it the type (Hibernate type which binds the java and sql type) to use for that property.
If thats *really* what you want I'll be happy to add an interface that Hibernate can ask for the Hibernate type it should use for a given property when that property defines no type. Y'all can then do this look up in a custom impl of that interface.
Why do I say that that is what you are asking for? Well how else are you expecting it to know what JDBC type to correlate to that java type for that given property? Surely you are not suggesting that we assume the widest possible JDBC data type (aka map all strings to CLOB by default). That would be insane.
> insert long string (more than 32700) fails on derby
> ---------------------------------------------------
>
> Key: HHH-1501
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.5.0-Beta-2
> Environment: Derby 10
> Reporter: Sergey Vladimirov
> Priority: Trivial
>
> http://issues.apache.org/jira/browse/DERBY-102
> VARCHAR maximum length 32 672
> LONG VARCHAR maximum length 32 700
> CLOB maximum length 2 147 483 647
> BLOB maximum length 2 147 483 647
> this issue can be reproduced by org.hibernate.test.lob.TextTest (in 3.5 beta1,2) with change org.hibernate.test.lob.LongStringTest.LONG_STRING_SIZE > 32700
--
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
14 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1501) insert long string (more than 32700) fails on derby
by Jeff Schnitzer (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501?page=c... ]
Jeff Schnitzer commented on HHH-1501:
-------------------------------------
I'm in agreement with Sergey.
I have developed some software that *theoretically* can be deployed on any database. This is one of the promises of ORM, no? In practice, this doesn't really work very well, and this is one of the reasons why.
I should be able to declare a byte[] field in Java and Hibernate should figure out how to map that to various databases. You can point at Derby as broken (maybe it is) but the bottom line is that this is something the ORM layer should worry about, not individual developers - or worse - the poor bastards that download my code and try to run it against their obscure XYZ database. I'd like to say that my software works "on any database with a Hibernate dialect" but instead I have to say that my software works "on any database with a *working* Hibernate dialect".
> insert long string (more than 32700) fails on derby
> ---------------------------------------------------
>
> Key: HHH-1501
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.5.0-Beta-2
> Environment: Derby 10
> Reporter: Sergey Vladimirov
> Priority: Trivial
>
> http://issues.apache.org/jira/browse/DERBY-102
> VARCHAR maximum length 32 672
> LONG VARCHAR maximum length 32 700
> CLOB maximum length 2 147 483 647
> BLOB maximum length 2 147 483 647
> this issue can be reproduced by org.hibernate.test.lob.TextTest (in 3.5 beta1,2) with change org.hibernate.test.lob.LongStringTest.LONG_STRING_SIZE > 32700
--
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
14 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1501) insert long string (more than 32700) fails on derby
by Sergey Vladimirov (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501?page=c... ]
Sergey Vladimirov commented on HHH-1501:
----------------------------------------
Steve,
I'm sorry that it looks like i require some inadequate behavior from Hibernate and/or it's developers. It's purely your rule what shall it do and how should it work.
The reason of filling this bug is that i feel that Derby dialect has not just a wrong behaviour, but it is incompatible with other dialects because of this bug. Let me explain.
I'm considering Hibernate as the most powerfull JPA implementation at this moment. As part of it I considering it as something, that abstracts my application from database vendor-specific details. In a such way, that I can throw out MySQL InnoDB (that is currently used) and use Derby (that is used for testing now) or Oracle or MySQL MyISAM or MS SQL. And, according to my understanding of Hibernate place in application stack, such change shall only require single change in application configuration - just replace the dialect.
But the issue, described in this bug, introduces incompatibility between, for example, MySQL and Derby. If I declare some property as LOB String, it can contain up to 2 Gb of data, if MySQL dialect is used. But with Derby dialect it can contain only 32 Kb of data. Thus, we have and incompatibility between dialect, and, i believe, Derby dialect shall be fixed. Or, at least, it shall be described clearly by HIbernate, that 32 Kb is the minimum guarantly of Lob length.
Filling this bug was a gesture, not a requirement. We already created our version of MySQL, MS SQL and Derby dialects to enforce some additional compatibility. But I believe that those fixes and such interdialect compatibility shall be part of Hibernate without additional code by user in future versions of Hibernate.
If you insist that such changes shall not be made in Hibernate - it's okay. But personally i believe that such a requirement will arise again as soon as someone will need to work with different databases from same application.
Thanks for your work and best regards,
Sergey Vladimirov
> insert long string (more than 32700) fails on derby
> ---------------------------------------------------
>
> Key: HHH-1501
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.5.0-Beta-2
> Environment: Derby 10
> Reporter: Sergey Vladimirov
> Priority: Trivial
>
> http://issues.apache.org/jira/browse/DERBY-102
> VARCHAR maximum length 32 672
> LONG VARCHAR maximum length 32 700
> CLOB maximum length 2 147 483 647
> BLOB maximum length 2 147 483 647
> this issue can be reproduced by org.hibernate.test.lob.TextTest (in 3.5 beta1,2) with change org.hibernate.test.lob.LongStringTest.LONG_STRING_SIZE > 32700
--
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
14 years, 7 months
[Hibernate-JIRA] Commented: (HHH-672) bug in ComponentType isModified method ClassCastException (dom4j)
by Jason Clawson (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-672?page=co... ]
Jason Clawson commented on HHH-672:
-----------------------------------
I apologize, I am not sure how to write a unit test for ComponentType. I am not that familiar with how the object graph gets created. If someone could help me out with this, I would appreciate it.
> bug in ComponentType isModified method ClassCastException (dom4j)
> -----------------------------------------------------------------
>
> Key: HHH-672
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-672
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate 3.1 (stream), oracle 9.02
> Reporter: Jessica Marchiori
> Attachments: ComponentType.java.patch
>
>
> There is a bug with the EntityMode.DOM4j in class ComponentType method isModified. The association of oldValues causes a ClassCastException
> The original code was
> public boolean isModified(Object old, Object current, SessionImplementor session)
> throws HibernateException {
> if ( current == null ) return old != null;
> if ( old == null ) return current != null;
> Object[] currentValues = getPropertyValues( current, session );
> Object[] oldValues = ( Object[] ) old;
> }
>
> for ( int i = 0; i < currentValues.length; i++ ) {
> if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> return true;
> }
> }
> return false;
> }
> I have changed the code as below
> public boolean isModified(Object old, Object current, SessionImplementor session)
> throws HibernateException {
> if ( current == null ) return old != null;
> if ( old == null ) return current != null;
> Object[] currentValues = getPropertyValues( current, session );
> Object[] oldValues = getPropertyValues( old, session );
>
> for ( int i = 0; i < currentValues.length; i++ ) {
> if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> return true;
> }
> }
> return false;
> }
> and it works
--
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
14 years, 7 months
[Hibernate-JIRA] Updated: (HHH-672) bug in ComponentType isModified method ClassCastException (dom4j)
by Jason Clawson (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-672?page=co... ]
Jason Clawson updated HHH-672:
------------------------------
Attachment: ComponentType.java.patch
Patch for ComponentType
> bug in ComponentType isModified method ClassCastException (dom4j)
> -----------------------------------------------------------------
>
> Key: HHH-672
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-672
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate 3.1 (stream), oracle 9.02
> Reporter: Jessica Marchiori
> Attachments: ComponentType.java.patch
>
>
> There is a bug with the EntityMode.DOM4j in class ComponentType method isModified. The association of oldValues causes a ClassCastException
> The original code was
> public boolean isModified(Object old, Object current, SessionImplementor session)
> throws HibernateException {
> if ( current == null ) return old != null;
> if ( old == null ) return current != null;
> Object[] currentValues = getPropertyValues( current, session );
> Object[] oldValues = ( Object[] ) old;
> }
>
> for ( int i = 0; i < currentValues.length; i++ ) {
> if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> return true;
> }
> }
> return false;
> }
> I have changed the code as below
> public boolean isModified(Object old, Object current, SessionImplementor session)
> throws HibernateException {
> if ( current == null ) return old != null;
> if ( old == null ) return current != null;
> Object[] currentValues = getPropertyValues( current, session );
> Object[] oldValues = getPropertyValues( old, session );
>
> for ( int i = 0; i < currentValues.length; i++ ) {
> if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> return true;
> }
> }
> return false;
> }
> and it works
--
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
14 years, 7 months
[Hibernate-JIRA] Commented: (HHH-672) bug in ComponentType isModified method ClassCastException (dom4j)
by Gail Badner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-672?page=co... ]
Gail Badner commented on HHH-672:
---------------------------------
Please do the following:
* svn co http://anonsvn.jboss.org/repos/hibernate/core/trunk/
* update an existing test or add a new test to testsuite/src/test/java/org/hibernate/test/component
* attach a patch with the updated/added unit test using svn diff
* attach a patch with your fix using svn diff
Thanks,
Gail
> bug in ComponentType isModified method ClassCastException (dom4j)
> -----------------------------------------------------------------
>
> Key: HHH-672
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-672
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate 3.1 (stream), oracle 9.02
> Reporter: Jessica Marchiori
>
> There is a bug with the EntityMode.DOM4j in class ComponentType method isModified. The association of oldValues causes a ClassCastException
> The original code was
> public boolean isModified(Object old, Object current, SessionImplementor session)
> throws HibernateException {
> if ( current == null ) return old != null;
> if ( old == null ) return current != null;
> Object[] currentValues = getPropertyValues( current, session );
> Object[] oldValues = ( Object[] ) old;
> }
>
> for ( int i = 0; i < currentValues.length; i++ ) {
> if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> return true;
> }
> }
> return false;
> }
> I have changed the code as below
> public boolean isModified(Object old, Object current, SessionImplementor session)
> throws HibernateException {
> if ( current == null ) return old != null;
> if ( old == null ) return current != null;
> Object[] currentValues = getPropertyValues( current, session );
> Object[] oldValues = getPropertyValues( old, session );
>
> for ( int i = 0; i < currentValues.length; i++ ) {
> if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> return true;
> }
> }
> return false;
> }
> and it works
--
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
14 years, 7 months
[Hibernate-JIRA] Commented: (HHH-672) bug in ComponentType isModified method ClassCastException (dom4j)
by Jason Clawson (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-672?page=co... ]
Jason Clawson commented on HHH-672:
-----------------------------------
Can someone please fix this issue. It's been 5 years.... 5 YEARS guys, and a patch has been posted. Its a very simple fix... Please fix this. Thank you.
> bug in ComponentType isModified method ClassCastException (dom4j)
> -----------------------------------------------------------------
>
> Key: HHH-672
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-672
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate 3.1 (stream), oracle 9.02
> Reporter: Jessica Marchiori
>
> There is a bug with the EntityMode.DOM4j in class ComponentType method isModified. The association of oldValues causes a ClassCastException
> The original code was
> public boolean isModified(Object old, Object current, SessionImplementor session)
> throws HibernateException {
> if ( current == null ) return old != null;
> if ( old == null ) return current != null;
> Object[] currentValues = getPropertyValues( current, session );
> Object[] oldValues = ( Object[] ) old;
> }
>
> for ( int i = 0; i < currentValues.length; i++ ) {
> if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> return true;
> }
> }
> return false;
> }
> I have changed the code as below
> public boolean isModified(Object old, Object current, SessionImplementor session)
> throws HibernateException {
> if ( current == null ) return old != null;
> if ( old == null ) return current != null;
> Object[] currentValues = getPropertyValues( current, session );
> Object[] oldValues = getPropertyValues( old, session );
>
> for ( int i = 0; i < currentValues.length; i++ ) {
> if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> return true;
> }
> }
> return false;
> }
> and it works
--
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
14 years, 7 months