[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6545) @Column(columnDefinition = ...) ignored unless placed by get method.

Frank Langelage (JIRA) noreply at atlassian.com
Thu Aug 4 13:28:02 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43176#comment-43176 ] 

Frank Langelage commented on HHH-6545:
--------------------------------------

>From my understanding and experiance you must not use Annotations on fields and getters within on entity.
Either put them all ond the fields or all on the getters.
This would explain why the second version is working.

> @Column(columnDefinition = ...) ignored unless placed by get method.
> --------------------------------------------------------------------
>
>                 Key: HHH-6545
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6545
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations
>         Environment: Linux omega 2.6.32-33-generic-pae #71-Ubuntu SMP Wed Jul 20 18:46:41 UTC 2011 i686 GNU/Linux 
> Java(TM) SE Runtime Environment (build 1.6.0_26-b03) 
> jboss-as-7.0.0.Final 
> mysql-connector-java-5.1.15.jar 
> mysql-server-5.1 (5.1.41-3ubuntu12.10)
>            Reporter: jee4hire
>
> >>>Not working: @Column is placed with variable definition.
> Column data is created in database as type tinyblob.
> Thus, @Column(columnDefinition = "blob") is ignored.
> @Entity
> public class File implements Serializable {
> private Long id;
> @NotNull @Column(columnDefinition = "blob")
> private byte [] data;
> @Id @GeneratedValue
> public Long getId() { return id; }
> public void setId(Long i) { id = i; }
> public byte [] getData() { return data; }
> public void setData(byte [] d) { data = d; }
> }
> ##############################################################################
> >>>Workaround: @Column is placed with get method.
> Then, column data is created in database as type blob.
> @Entity
> public class File implements Serializable {
> private Long id;
> private byte [] data;
> @Id @GeneratedValue
> public Long getId() { return id; }
> public void setId(Long i) { id = i; }
> @NotNull @Column(columnDefinition = "blob")
> public byte [] getData() { return data; }
> public void setData(byte [] d) { data = d; }
> }
> ##############################################################################
> Excerpt from: jboss-as-7.0.0.Final/standalone/configuration/standalone.xml
> <subsystem xmlns="urn:jboss:domain:datasources:1.0">
> <datasources>
> <datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySqlDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
> <connection-url>
> jdbc:mysql://localhost:3306/jboss
> </connection-url>
> <driver>
> com.mysql
> </driver>
> <transaction-isolation>
> TRANSACTION_READ_COMMITTED
> </transaction-isolation>
> <pool>
> <min-pool-size>
> 10
> </min-pool-size>
> <max-pool-size>
> 100
> </max-pool-size>
> <prefill>
> true
> </prefill>
> <use-strict-min>
> false
> </use-strict-min>
> <flush-strategy>
> FailingConnectionOnly
> </flush-strategy>
> </pool>
> <security>
> <user-name>
> *************
> </user-name>
> <password>
> *************
> </password>
> </security>
> <statement>
> <prepared-statement-cache-size>
> 32
> </prepared-statement-cache-size>
> <share-prepared-statements/>
> </statement>
> </datasource>
> <drivers>
> <driver name="com.mysql" module="com.mysql">
> <xa-datasource-class>
> com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
> </xa-datasource-class>
> </driver>
> <driver name="h2" module="com.h2database.h2">
> <xa-datasource-class>
> org.h2.jdbcx.JdbcDataSource
> </xa-datasource-class>
> </driver>
> </drivers>
> </datasources>
> </subsystem>
> ##############################################################################
> war jars:
> 61504 Defl:N 56482 8% 2011-07-21 10:31 92d0520b WEB-INF/lib/i18nlog-1.0.10.jar
> 358085 Defl:N 324832 9% 2011-04-04 11:37 8c574f28 WEB-INF/lib/log4j-1.2.12.jar
> 47399 Defl:N 41460 13% 2011-07-21 10:31 ac044dbb WEB-INF/lib/jboss-logging-3.0.0.Beta5.jar
> 204093 Defl:N 181695 11% 2011-07-07 12:54 ed9a2ff2 WEB-INF/lib/picketlink-idm-core-1.5.0.Alpha02.jar
> 55966 Defl:N 44907 20% 2011-07-07 12:54 d81b0cc2 WEB-INF/lib/seam-international-3.0.0.Final.jar
> 529064 Defl:N 490198 7% 2011-07-18 14:13 cb9a1aec WEB-INF/lib/quartz-2.0.1.jar
> 1627515 Defl:N 1470306 10% 2011-07-07 12:54 e71d8ef4 WEB-INF/lib/primefaces-3.0.M2.jar
> 231287 Defl:N 203688 12% 2011-07-21 10:31 76154858 WEB-INF/lib/jboss-marshalling-1.3.0.CR9.jar
> 2479225 Defl:N 2249049 9% 2011-08-03 07:41 f775e5eb WEB-INF/lib/richfaces-components-ui-4.1.0-20110802.221239-82.jar
> 543011 Defl:N 456324 16% 2011-07-12 14:02 f915bdef WEB-INF/lib/joda-time-1.6.1.jar
> 80863 Defl:N 74890 7% 2011-07-21 10:31 1074f519 WEB-INF/lib/jboss-marshalling-river-1.3.0.CR9.jar
> 153633 Defl:N 139858 9% 2011-07-18 08:58 267a0105 WEB-INF/lib/seam-security-impl-3.0.1-20110624.041853-12.jar
> 546379 Defl:N 489412 10% 2011-07-21 10:38 7810d5c7 WEB-INF/lib/jboss-common-core-2.2.17.GA.jar
> 161455 Defl:N 122304 24% 2011-07-12 15:10 55c0bc93 WEB-INF/lib/knowledge-api-5.2.0.Final.jar
> 1902276 Defl:N 1719856 10% 2011-07-12 15:10 91eaa4f6 WEB-INF/lib/drools-core-5.2.0.Final.jar
> 15071 Defl:N 12479 17% 2011-04-04 11:31 a1e02acb WEB-INF/lib/jta-1.1.jar
> 7635 Defl:N 5428 29% 2011-07-21 10:31 ed71d5ec WEB-INF/lib/rhq-pluginAnnotations-3.0.1.jar
> 897071 Defl:N 858346 4% 2011-07-12 15:16 a1635c95 WEB-INF/lib/antlr-3.3.jar
> 91540 Defl:N 81205 11% 2011-07-25 08:27 6d5bdd9e WEB-INF/lib/seam-config-xml-3.0.1-20110723.041850-8.jar
> 443432 Defl:N 420698 5% 2011-05-16 12:02 d108cdd2 WEB-INF/lib/antlr-2.7.6.jar
> 1674737 Defl:N 1601274 4% 2011-07-07 12:55 b5de0b5f WEB-INF/lib/ecj-3.5.1.jar
> 10899 Defl:N 7710 29% 2011-07-21 10:31 b580639d WEB-INF/lib/jboss-transaction-api-1.0.1.GA.jar
> 15808 Defl:N 12066 24% 2011-07-07 12:54 cbb7cd31 WEB-INF/lib/sac-1.3.jar
> 269014 Defl:N 245020 9% 2011-06-20 14:42 0d19c92a WEB-INF/lib/commons-net-3.0.1.jar
> 1472606 Defl:N 1320427 10% 2011-07-21 10:31 0084c472 WEB-INF/lib/infinispan-core-5.0.0.CR7.jar
> 7457 Defl:N 5972 20% 2011-07-18 14:13 cdac3310 WEB-INF/lib/quartz-jboss-2.0.1.jar
> 713433 Defl:N 657365 8% 2011-07-12 15:10 3e88a598 WEB-INF/lib/mvel2-2.1.0.drools2.jar
> 12623 Defl:N 10267 19% 2011-07-21 10:38 77d0c4ba WEB-INF/lib/jboss-logging-spi-2.1.0.GA.jar
> 253950 Defl:N 241386 5% 2011-05-12 11:27 f758d70e WEB-INF/lib/cssparser-0.9.5.jar
> 1114265 Defl:N 987976 11% 2011-05-12 11:27 57d773f1 WEB-INF/lib/guava-r08.jar
> 25496 Defl:N 22183 13% 2011-07-14 12:55 1a95d60b WEB-INF/lib/slf4j-api-1.6.1.jar
> 85262 Defl:N 64318 25% 2011-08-03 07:41 09f14670 WEB-INF/lib/richfaces-components-api-4.1.0-20110802.221059-82.jar
> 119223 Defl:N 103690 13% 2011-07-18 08:58 fb1581b3 WEB-INF/lib/seam-persistence-3.0.1-20110711.040751-17.jar
> 148627 Defl:N 138829 7% 2011-07-12 15:16 3e8b388d WEB-INF/lib/stringtemplate-3.2.1.jar
> 397907 Defl:N 343667 14% 2011-07-07 12:54 7f34b227 WEB-INF/lib/seam-solder-3.0.0.Final.jar
> 102661 Defl:N 80043 22% 2011-07-07 12:54 b67dd2a4 WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
> 2135793 Defl:N 2028099 5% 2011-07-21 10:31 ade69d61 WEB-INF/lib/jgroups-2.12.0.Final.jar
> 988489 Defl:N 902079 9% 2011-07-12 15:16 22c8db9d WEB-INF/lib/drools-compiler-5.2.0.Final.jar
> 424253 Defl:N 391533 8% 2011-08-04 07:24 9a1f5dba WEB-INF/lib/richfaces-core-impl-4.1.0-20110803.165959-73.jar
> 83291 Defl:N 68465 18% 2011-08-03 07:41 d9920651 WEB-INF/lib/seam-servlet-3.0.1-20110803.040537-7.jar
> 33716 Defl:N 23689 30% 2011-07-18 08:58 3a591eab WEB-INF/lib/seam-security-api-3.0.1-20110624.041806-12.jar
> 163650 Defl:N 149460 9% 2011-07-12 15:16 e8acd98f WEB-INF/lib/antlr-runtime-3.3.jar
> 136498 Defl:N 115026 16% 2011-08-04 07:24 010242c6 WEB-INF/lib/richfaces-core-api-4.1.0-20110803.165751-75.jar
> 608376 Defl:N 554163 9% 2011-07-14 12:55 4bb8e85b WEB-INF/lib/c3p0-0.9.1.1.jar
> 23055 Defl:N 14694 36% 2011-07-07 12:54 5dfcdff2 WEB-INF/lib/picketlink-idm-spi-1.5.0.Alpha02.jar
> 27714 Defl:N 18846 32% 2011-07-07 12:54 9718b1ca WEB-INF/lib/picketlink-idm-api-1.5.0.Alpha02.jar
> 25717 Defl:N 20670 20% 2011-07-07 12:54 8473b909 WEB-INF/lib/picketlink-idm-common-1.5.0.Alpha02.jar

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list