-->
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.  [ 1 post ] 
Author Message
 Post subject: Single table how to disable the implicit polymorphism?
PostPosted: Wed Feb 21, 2007 7:59 am 
Newbie

Joined: Mon Aug 28, 2006 6:31 am
Posts: 16
Hello, i've got following mapping:

Parent of the Class hierarchy:

Code:
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
abstract class AbstractClass{
}


Children:
Code:
@DiscriminatorValue('A')
class A extends AbstractClass{


@OneToOne
@JoinColumn
C c;

}

@DiscriminatorValue('B')
class B extends A{

}



and the consumer:

Code:
class C{
   
@OneToOne(mappedBy = "c", targetEntity = A.class)
@JoinColumn
A a;

@OneToOne(mappedBy = "c", targetEntity = B.class)
@JoinColumn
B b;

}


if i try to retrieve all C's i get an exception and a Query with polymorphic "where" for attribute a like bellow:
Code:
select * from C  c
where c.a.dtype in (
'A', 'B'
)
and c.b.dtype in ('B');


How can i restrict the discriminator value (dtype) of a to 'A' bypassing the implicit query polymorphism. I thought, that targetEntity=A.class could help but it didn't.

Need a help, thanks for advice!

Gena


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

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.