-->
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.  [ 3 posts ] 
Author Message
 Post subject: Inheritence does not work using Programmatic API
PostPosted: Thu Jun 17, 2010 7:49 am 
Beginner
Beginner

Joined: Mon Mar 01, 2010 12:24 pm
Posts: 22
Hi,
I created four simple projects :
- the first one using annotations mapping a simple Class,
- the second one using annotations mapping an inherited Class,
- the third one using programmatic API mapping a simple Class,
- and the last one using programmatic API mapping an inherited Class.

Code of the main class:
Code:
public class ActivityDefinition implements Serializable {

  private static final long serialVersionUID = -6281358760252663359L;

  private String name;
  private int priority;

  protected ActivityDefinition() {}
 
  public ActivityDefinition(String name, int priority) {
    super();
    this.name = name;
    this.priority = priority;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getPriority() {
    return priority;
  }

  public void setPriority(int priority) {
    this.priority = priority;
  }
  ...
}

And of the inherited class:
Code:
public class SubActivityDefinition extends ActivityDefinition {

  private static final long serialVersionUID = -6848792468747886255L;
  protected long dbid;

  protected SubActivityDefinition() {}

  public SubActivityDefinition(String name, int priority) {
    super(name, priority);
  }

  public Long getDbid() {
    return dbid;
  }

  public void setDbid(Long dbid) {
    this.dbid = dbid;
  }

}


Everything works properly except when searching on the inherited class using programmatic API: the result list is empty! After several attempts, I found a work around: I have to override getters in the inherited class.
i.e.
Code:
public class InternalActivityDefinition extends ActivityDefinition {
  ...
  public String getName() {
    return super.getName();
  }

  public int getPriority() {
    return super.getPriority();
  }
  ...
}


Is there a parameter or a way to avoid this work around?

Regards,
Matti


Top
 Profile  
 
 Post subject: Re: Inheritence does not work using Programmatic API
PostPosted: Fri Jun 18, 2010 7:20 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Can you show the programmatic API mapping code and the query code you've used to see the problem? Ideally create a small test case and post it as a JIRA issue.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Re: Inheritence does not work using Programmatic API
PostPosted: Mon Jun 28, 2010 10:19 am 
Beginner
Beginner

Joined: Mon Mar 01, 2010 12:24 pm
Posts: 22
Hi,

I open a new JIRA issue: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-551

Regards,
Matti


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