-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Wrong column type (oracle) Found: number, expected: boolean
PostPosted: Tue Jul 19, 2011 9:35 am 
Newbie

Joined: Tue Jul 19, 2011 9:19 am
Posts: 5
Using Hibernate 4.0.0.Beta1 (while migrating to JBoss 7.0.0.Final) I get the following error while deploying when using the schema validator from hibernate (DB is Oracle Database 10g Enterprise Edition Release 10.2.0.1.0):

Code:
14:30:14,800 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-2) HHH00037:Columns: [emp_year_of_birth, emp_password, emp_extern, emp_id, emp_firstname, emp_location, emp_override_grp, emp_lastname, emp_login, emp_group_id, emp_experience_since, emp_email]
14:30:14,815 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.persistenceunit."MyApp.ear/myapp-server-2.3.7-SNAPSHOT.jar#MyAppPersistence": org.jboss.msc.service.StartException in service jboss.persistenceunit."MyApp.ear/myapp-server-2.3.7-SNAPSHOT.jar#MyAppPersistence": Failed to start service
   at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1786)
   at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
   at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: MyAppPersistence] Unable to build EntityManagerFactory
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:903)
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:879)
   at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
   at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:170)
   at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:80)
   at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
   ... 4 more
Caused by: org.hibernate.HibernateException: Wrong column type in MYSCHEMA.EMPLOYEE for column EMP_EXTERN. Found: number, expected: boolean
   at org.hibernate.mapping.Table.validateColumns(Table.java:281)
   at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1264)
   at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:449)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1720)
   at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:77)
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:894)
   ... 9 more



Here the simplified DDL of the table EMPLOYEE:

Code:
CREATE TABLE "MYSCHEMA"."EMPLOYEE"
  (
    "EMP_ID"               NUMBER(10,0) NOT NULL ENABLE,
    "EMP_FIRSTNAME"        VARCHAR2(100 BYTE) NOT NULL ENABLE,
    "EMP_LASTNAME"         VARCHAR2(100 BYTE) NOT NULL ENABLE,
    "EMP_LOGIN"            VARCHAR2(100 BYTE),
    "EMP_EMAIL"            VARCHAR2(100 BYTE),
    "EMP_LOCATION"         VARCHAR2(100 BYTE),
    "EMP_GROUP_ID"         NUMBER(10,0) NOT NULL ENABLE,
    "EMP_PASSWORD"         VARCHAR2(100 BYTE),
    "EMP_OVERRIDE_GRP"     NUMBER DEFAULT 0 NOT NULL ENABLE,
    "EMP_YEAR_OF_BIRTH"    NUMBER(*,0) DEFAULT 0,
    "EMP_EXPERIENCE_SINCE" NUMBER(*,0) DEFAULT 0,
    "EMP_EXTERN"           NUMBER(1,0) DEFAULT 0 NOT NULL ENABLE
  )


Here is the persistence.xml:

Code:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
             http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
   version="2.0">
   <persistence-unit name="MyAppPersistence"
      transaction-type="JTA">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/MyAppDS</jta-data-source>
      <properties>
      ...
         <property name="hibernate.hbm2ddl.auto" value="validate" />

         <property name="hibernate.show_sql" value="false" />
         <property name="hibernate.format_sql" value="true" />
         <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
         <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
         <property name="hibernate.transaction.manager_lookup_class"
            value="org.hibernate.transaction.JBossTransactionManagerLookup" />
      </properties>
   </persistence-unit>
</persistence>


And this is the Entity Employee.java:

Code:
@Entity
@Indexed
@Table( name = "EMPLOYEE" )
public class Employee
{
     // other fields omitted

    @Column( name = "EMP_EXTERN", nullable = false )
    private boolean extern;
   
    // getters and setters omitted

}


I haven't found this issue yet. With Hibernate 3 this error wasn't present with the same schema and entity.

Does anybody have an idea what's going wrong?


Top
 Profile  
 
 Post subject: Re: Wrong column type (oracle) Found: number, expected: boolean
PostPosted: Wed Jul 20, 2011 9:47 am 
Newbie

Joined: Wed Jul 20, 2011 9:32 am
Posts: 2
I experienced the same problems with JBoss 7.0.0.Final and the Oracle DB

It also happens when you use
Code:
<property name="hibernate.hbm2ddl.auto" value="create" />

instead of validate. It simply will produce a wrong DDL trying to create a boolean column on the Oracle DB
which results in an Error:
Quote:
ORA-00902: invalid datatype.


Thats a showstopper for all Oracle DB users.
I guess its a problem in Hibernate 4.0.0.Beta1

Maybe raising an jira-issue is appropriate.

Cheers,
Kosta


Top
 Profile  
 
 Post subject: Re: Wrong column type (oracle) Found: number, expected: boolean
PostPosted: Wed Jul 20, 2011 10:21 am 
Newbie

Joined: Tue Jul 19, 2011 9:19 am
Posts: 5
Thanks for your affirmation, Kosta.

I created an issue:
https://hibernate.onjira.com/browse/HHH-6463

greetings
Riggs


Top
 Profile  
 
 Post subject: Re: Wrong column type (oracle) Found: number, expected: boolean
PostPosted: Wed Jul 20, 2011 4:26 pm 
Newbie

Joined: Wed Jul 20, 2011 9:32 am
Posts: 2
Hi Riggs / Thomas ;),

I had created also an issue on the jboss side.
https://issues.jboss.org/browse/AS7-1354

I still think this issue is a blocker, esp. for domain-driven development.
You can't let jboss/hibernate create your db-tables on an oracle as it tryes to use boolean which fails badly.

Does your app work fine besides the failing validation ?
I was migrating an old applikation to jboss as7 and the failing validation was a showstopper to me, did not even try yet if the "un-validated" app runs fine.


Top
 Profile  
 
 Post subject: Re: Wrong column type (oracle) Found: number, expected: boolean
PostPosted: Wed Jul 20, 2011 4:43 pm 
Newbie

Joined: Tue Jul 19, 2011 9:19 am
Posts: 5
Hi Kosta! ;)

yes, you're right. I haven't thought of the DDD-case with this issue.

Besides that out app runs fine on AS7.
Was not that easy because of dependencies and the new classloader architecturs etc.

The last issue that is holding us from going live is mailing the logs:
http://community.jboss.org/thread/169581?tstart=0

greets
Riggs


Top
 Profile  
 
 Post subject: Re: Wrong column type (oracle) Found: number, expected: boolean
PostPosted: Fri Jul 22, 2011 4:49 am 
Newbie

Joined: Fri Jul 22, 2011 4:38 am
Posts: 1
hi
Thanks to all the info,
But
I don't really know what JIRA is by the way, so hopefully nobody is upset by this post. I first mailed Gavin but he told me I should put it in JIRA.

I currently work on a project which uses Seam Remoting directly and I didn't find a neat way in handling errors on the client side as Exceptions are not propagated to it. Therefore I changed Seam to transmit all exceptions which can be handled in the javascript part via another callback. E.g.:

Seam.Component.getInstance('userManager').currentUser(function(user) {
alert("user: " + user);
},
function(ex) {
alert("exception occured: " + ex.getMessage());
});

As the exception handler is optional, the change would not brake any client code.

Best Wishes
Carla

_________________
how to kiss


Top
 Profile  
 
 Post subject: Re: Wrong column type (oracle) Found: number, expected: boolean
PostPosted: Fri Jul 22, 2011 5:02 am 
Newbie

Joined: Tue Jul 19, 2011 9:19 am
Posts: 5
Hi Carla,

I don't see a connection between what you wrote and the topic of this thread.
Are you sure you wanted to post it here?

Greets
Riggs


Top
 Profile  
 
 Post subject: Re: Wrong column type (oracle) Found: number, expected: boolean
PostPosted: Fri Aug 19, 2011 11:54 am 
Newbie

Joined: Tue Aug 16, 2011 5:58 pm
Posts: 6
Riggs,

Has there been any progress with this issue, for some reason the problem links are not working for me at the moment so I thought I would just ask you directly seeing as how you are the most involved on this thread. I have bee doing a little work trying to conduct some cloud computing experiments with IT monitoring and the link would be very helpful if you could get it back and working. Thanks so much man, this would be a perfect task to complete for my resume before I hunt down a good IT staffing firm.


Last edited by grizzkeys on Wed Dec 28, 2011 3:10 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject: Re: Wrong column type (oracle) Found: number, expected: boolean
PostPosted: Fri Aug 19, 2011 1:31 pm 
Newbie

Joined: Tue Jul 19, 2011 9:19 am
Posts: 5
Hi grizzkeys,

sorry, I haven't seen any progress here yet.
The link to the issue works fine for me:
https://hibernate.onjira.com/browse/HHH-6463

Haven't had time yet to provide a test case.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.