Announcement Announcement Module
Collapse
No announcement yet.
Wrong column type for column. Found: char, expected: varchar2(4) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wrong column type for column. Found: char, expected: varchar2(4)

    I am using 1.2.1 version of spring roo,

    Getting below exception when we execute mvn clean tomcat:run

    Caused by: org.hibernate.HibernateException: Wrong column type for column HISTORY. Found: char, expected: varchar2(4)

    PK_Roo_Identifier.aj files generates below column,

    @Column(name = "HISTORY", nullable = false, length = 4)
    private String IsSmbAreaDimPK.history;

    dbre.xml file has correct column type,

    <column name="HISTORY" primaryKey="false" required="false" scale="0" size="4" type="1,CHAR"/>

    Also my ddl statement is,

    CREATE TABLE "IS_"."IS_HISTORY"
    ( "HISTORY" CHAR(1 CHAR),

    ) SEGMENT CREATION IMMEDIATE

    Found the same issue in jira and it got closed in 1.1.1 release,

    https://jira.springsource.org/browse...ctionOrder=asc

    Not sure why the variable got created as String even it is CHAR type in dbre.xml?

    Could you please let me know why length got added as 4 also why it didn't add columnDefinition = “char”?

    Please let me know how to fix this issue.

    Thanks,
    Riyaz

  • #2
    I'm having the same issue. In my case the there are two CHAR fields on a table that are part of a composite primary key. The first one gets created as a string in the PK_Roo_Identifier aspect, the other one gets set as a Character. This creates a Hibernate exception on initialization when the app tries to create the entityManager. I created my tables using Roo 1.2.2.RELEASE and the dbre addon plugin to reverse engineer an Oracle database.
    Any suggestions on how to fix this??

    Comment


    • #3
      I have fixed this issue with --includeNonPortableAttributes option while creating dbre. This option has created columnDefinition = “char” in identifier.aj file.

      Not sure on your case since it is primary key.

      Comment


      • #4
        Originally posted by mkandrat View Post
        I have fixed this issue with --includeNonPortableAttributes option while creating dbre. This option has created columnDefinition = “char” in identifier.aj file.

        Not sure on your case since it is primary key.
        I think this is a bug in DBRE ... can you create an issue into https://jira.springsource.org/browse/ROO ?

        Comment


        • #5
          Thanks for the reply, I have created an issue in jira.

          Comment

          Working...
          X