4 Replies Latest reply on Dec 12, 2007 3:08 PM by Zahid Shaikh

    EJB3, NVARCHAR2 and Oracle10g

    Vijayanandraj Amaladoss Newbie

      I am using Seam 2.0 and when I try mapping a existing table nvarchar2 column to a EJb3 entity attribute, I am getting a following exception.

       [testng] javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: CITY, expected: varchar2(255)
      



      I googled and searched the forum(hibernate), but nothing solved my problem. I have set the defaultNChar flag both in hibernate(persistence.xml) and datasource.xml.

      I even tried the columnDefinition suggested in seam forum. Below is the persistence.xml I am using.

       <persistence-unit name="hain">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/hainDatasource</jta-data-source>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
       <property name="hibernate.hbm2ddl.auto" value="validate"/>
       <property name="hibernate.show_sql" value="true"/>
       <property name="jboss.entity.manager.factory.jndi.name" value="java:/ChainEntityManagerFactory"/>
       <property name="hibernate.default_schema" value="hodb"/>
       <property name="hibernate.connection.defaultNChar" value = "true"/>
       </properties>
       </persistence-unit>
      
      </persistence>


      hain-ds.xml

      <datasources>
      
       <local-tx-datasource>
       <jndi-name>hainDatasource</jndi-name>
       <connection-url>jdbc:oracle:thin:@ts-dev:1521:tcdev</connection-url>
       <driver-class>oracle.jdbc.OracleDriver</driver-class>
       <user-name>user</user-name>
       <password>password</password>
       <connection-property name = "oracle.jdbc.defaultNChar">true</connection-property>
      
      </datasources>
      
      


      Is there any standard way defined in EJB3?. I refered both Pro EJB and EJB in Action books. But both didnt help.

      Thanks in Advance