-->
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.  [ 4 posts ] 
Author Message
 Post subject: Mixed inheritance strategy, @Formula and FetchMode.SELECT?
PostPosted: Mon Sep 22, 2008 12:11 pm 
Beginner
Beginner

Joined: Wed Jan 16, 2008 8:16 am
Posts: 23
Hi,

I'm using a mixed inheritance strategy; described in the book 'Hibernate in Action' (5.1.5) - mixing InheritanceType.SINGLE_TABLE with Secondary Table.

The base class:
Code:
@Entity
@Table(name = "BASE")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class Base {
...
}


One subclass:
Code:
@Entity
@DiscriminatorValue("V")
@SecondaryTable(
        name = "SUB",
        pkJoinColumns = @PrimaryKeyJoinColumn(name = "F_ID")
)
@Table(
    appliesTo = "SUB",
    fetch = FetchMode.SELECT,
    optional = false,
    inverse = false
)
public class Sub extends Base {
...
}


I have used 'FetchMode.SELECT' to force a inner join (instead of an outer join). What is the problem? Some of the subclasses has @Formula's. When I debug the generation of the sequential select, I found out that this select statement is wrong, concerning the owing @Formula's. The generated statement contains a Formula query from a different classes; means the @Formula was defined in a different subclass. So the query throws an exception.

Debugged: SingleTableEntityPersister#generateSequentialSelect.

Has anyone an idea, what is going wrong? Is this my bug or an hibernate one?

Hibernate: 3.2.5.ga

Thanks in advance,
best regards
Michi


Top
 Profile  
 
 Post subject: Bug: SingleTableEntityPersister - generateSequentialSelect()
PostPosted: Tue Sep 23, 2008 5:47 am 
Beginner
Beginner

Joined: Wed Jan 16, 2008 8:16 am
Posts: 23
Hi,

while debugging I found out that the creation of the sequential select - concerning the formulas - is wrong.

Method of interest: SingleTableEntityPersister#generateSequentialSelect

Code snippet:
Code:
        //figure out which formulas are needed
        ArrayList formulaNumbers = new ArrayList();
//        final int[] formulaTableNumbers = getSubclassColumnTableNumberClosure();
        final int[] formulaTableNumbers = getSubclassFormulaTableNumberClosure();
        for ( int i=0; i<getSubclassFormulaTemplateClosure().length; i++ ) {
            if ( tableNumbers.contains( new Integer( formulaTableNumbers[i] ) ) ) {
                formulaNumbers.add( new Integer(i) );
            }
        }


I commented the line with 'getSubclassColumnTableNumberClosure' out and replace it with 'getSubclassFormulaTableNumberClosure' and it works.

I hope it can help you and it will be fixed next version.

best regards,
michi



[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 6:38 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
Have you made a bug report?

http://opensource.atlassian.com/project ... board.jspa

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 6:47 am 
Beginner
Beginner

Joined: Wed Jan 16, 2008 8:16 am
Posts: 23
http://opensource.atlassian.com/project ... e/HHH-3492
done

best regards,
michi


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