You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Maxim Solodovnik <so...@gmail.com> on 2014/06/24 18:17:11 UTC

@MappedSuperclass fields not found

Hello All,

I'm trying to use @MappedSuperclass as follows:

@MappedSuperclass
public abstract class FileItem implements Serializable {
private static final long serialVersionUID = 1L;

@Column(name = "deleted")
protected boolean deleted;

public boolean isDeleted() {
return deleted;
}

public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
}

@Entity
@NamedQueries({
@NamedQuery(name = "get", query = "SELECT f FROM FlvRecording f WHERE
f.deleted = false")
})
@Table(name = "flvrecording")

public class FlvRecording extends FileItem {
private static final long serialVersionUID = 1L;
}


While trying to call named query I got:
An error occurred while parsing the query filter "SELECT f FROM
FlvRecording f WHERE f.deleted = false". Error message: No field named
"deleted" in "FlvRecording".

I also tried to make fields of abstract superclass private
tried to add
@Inheritance(strategy = InheritanceType.JOINED)

to FlvRecording class
What am I doing wrong?

Thanks advance for any help

-- 
WBR
Maxim aka solomax

Re: @MappedSuperclass fields not found

Posted by Maxim Solodovnik <so...@gmail.com>.
Thanks, for the quick response
It helps :)


On 24 June 2014 23:22, Rick Curtis <cu...@gmail.com> wrote:

> Are you listing the <class> elements in your persistence.xml? If so, try to
> add the MappedSuperclass to that list.
>
>
> On Tue, Jun 24, 2014 at 11:17 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Hello All,
> >
> > I'm trying to use @MappedSuperclass as follows:
> >
> > @MappedSuperclass
> > public abstract class FileItem implements Serializable {
> > private static final long serialVersionUID = 1L;
> >
> > @Column(name = "deleted")
> > protected boolean deleted;
> >
> > public boolean isDeleted() {
> > return deleted;
> > }
> >
> > public void setDeleted(boolean deleted) {
> > this.deleted = deleted;
> > }
> > }
> >
> > @Entity
> > @NamedQueries({
> > @NamedQuery(name = "get", query = "SELECT f FROM FlvRecording f WHERE
> > f.deleted = false")
> > })
> > @Table(name = "flvrecording")
> >
> > public class FlvRecording extends FileItem {
> > private static final long serialVersionUID = 1L;
> > }
> >
> >
> > While trying to call named query I got:
> > An error occurred while parsing the query filter "SELECT f FROM
> > FlvRecording f WHERE f.deleted = false". Error message: No field named
> > "deleted" in "FlvRecording".
> >
> > I also tried to make fields of abstract superclass private
> > tried to add
> > @Inheritance(strategy = InheritanceType.JOINED)
> >
> > to FlvRecording class
> > What am I doing wrong?
> >
> > Thanks advance for any help
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>
>
>
> --
> *Rick Curtis*
>



-- 
WBR
Maxim aka solomax

Re: @MappedSuperclass fields not found

Posted by Rick Curtis <cu...@gmail.com>.
Are you listing the <class> elements in your persistence.xml? If so, try to
add the MappedSuperclass to that list.


On Tue, Jun 24, 2014 at 11:17 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello All,
>
> I'm trying to use @MappedSuperclass as follows:
>
> @MappedSuperclass
> public abstract class FileItem implements Serializable {
> private static final long serialVersionUID = 1L;
>
> @Column(name = "deleted")
> protected boolean deleted;
>
> public boolean isDeleted() {
> return deleted;
> }
>
> public void setDeleted(boolean deleted) {
> this.deleted = deleted;
> }
> }
>
> @Entity
> @NamedQueries({
> @NamedQuery(name = "get", query = "SELECT f FROM FlvRecording f WHERE
> f.deleted = false")
> })
> @Table(name = "flvrecording")
>
> public class FlvRecording extends FileItem {
> private static final long serialVersionUID = 1L;
> }
>
>
> While trying to call named query I got:
> An error occurred while parsing the query filter "SELECT f FROM
> FlvRecording f WHERE f.deleted = false". Error message: No field named
> "deleted" in "FlvRecording".
>
> I also tried to make fields of abstract superclass private
> tried to add
> @Inheritance(strategy = InheritanceType.JOINED)
>
> to FlvRecording class
> What am I doing wrong?
>
> Thanks advance for any help
>
> --
> WBR
> Maxim aka solomax
>



-- 
*Rick Curtis*