-->
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.  [ 2 posts ] 
Author Message
 Post subject: discriminator formula
PostPosted: Thu Jun 08, 2006 8:54 am 
Regular
Regular

Joined: Mon Mar 06, 2006 6:18 am
Posts: 95
Location: Bern, Switzerland
Hello all

in my mapping file i have the following discriminator formula:

Code:
<discriminator
         type="java.lang.Integer"
         formula=" CASE ( SELECT TAGB.INUTZERGRUPPE FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)
                  WHEN 1 THEN 1
                  WHEN 2 AND (SELECT TAGB.FK_TAART_ILAUFNR FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=1 THEN 2
                  WHEN 2 AND (SELECT TAGB.FK_TAART_ILAUFNR FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=2 THEN 21
                  ELSE 0
                  END "/>



Unfortunatley it's not working. I always get an oracle error:

Code:
Caused by: java.sql.SQLException: ORA-00905: Missing kexword

   at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)


I'm using hibernate 3.1 and Oracle 10g Express Edition. Is it possible that my oracle version doesn't support the CASE??

Any help appreciated! Regards...
Angela


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 08, 2006 9:23 am 
Regular
Regular

Joined: Mon Mar 06, 2006 6:18 am
Posts: 95
Location: Bern, Switzerland
SOLUTION:

Code:
        <discriminator
         type="java.lang.Integer"
         formula=" CASE 
                  WHEN (SELECT TAGB.INUTZERGRUPPE FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=1 THEN 1
                  WHEN (SELECT TAGB.INUTZERGRUPPE FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=2 AND (SELECT TAGB.FK_TAART_ILAUFNR FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=1 THEN 2
                  WHEN (SELECT TAGB.INUTZERGRUPPE FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=2 AND (SELECT TAGB.FK_TAART_ILAUFNR FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=2 THEN 21
                  WHEN (SELECT TAGB.INUTZERGRUPPE FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=3 THEN 3
                  WHEN (SELECT TAGB.INUTZERGRUPPE FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=4 AND (SELECT TAGB.FK_TAART_ILAUFNR FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=3 THEN 4
                  WHEN (SELECT TAGB.INUTZERGRUPPE FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=4 AND (SELECT TAGB.FK_TAART_ILAUFNR FROM TANGEBOT TAGB WHERE FK_TANGE_ILAUFNR=TAGB.ILAUFNUMMER)=4 THEN 41
                  ELSE 0
                  END "/>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.