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: Embeddable for an abstract class
PostPosted: Fri Nov 12, 2010 4:24 pm 
Newbie

Joined: Fri Nov 12, 2010 4:03 pm
Posts: 5
Hi,

I want an embeddable abstract class that doesn't must contains all the subclass properties.
Is it possible?
If yes, which annotations does I need?
If no, is making the embeddable as an entity the only solution?

Let's take the following example:

Code:
@Entity
public class Page implements Serializable {

    @Id
    @GeneratedValue
    @Column(name = "id", nullable = false)
    private Long id;

    @Embedded
    private AbstractContent content;

    [...]
}


Code:
@Embeddable
public abstract class AbstractContent implements Serializable {

    [...]
}



Code:
public abstract class ValidContent extends AbstractContent {

    @Column(name = "content")
    private String content;

    [...]
}


Code:
public abstract class ErrorContent extends AbstractContent {

    @Column(name = "error")
    private String error;

    [...]
}


Maybe it's not an hibernate problem but I cannot go far away while my DBUnit Test complains about fields from subclass that - for the framework - doesnt' exists.

Code:
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
   <page  id="1" content="blabla"  />
   <page  id="1" error="blabla"  />
         [...]
</dataset>



Thanks to everyone, especially the one who will solve my problem ^^


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.