Announcement Announcement Module
Collapse
No announcement yet.
Error in simple named query, is not mapped Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error in simple named query, is not mapped

    Hello,

    When I try to deploy my application, I get an error like this:

    Error in named query: findSimCardHistory: org.hibernate.hql.internal.ast.QuerySyntaxExceptio n: SimCardHistory is not mapped [SELECT s FROM SimCardHistory as s]
    I also tryed "SELECT s FROM SimCardHistory s"

    I have no idea what can be wrong.


    Code:
    @Entity(name="simcardhistory")
    @NamedQuery(
        name="findSimCardHistory",
        query="SELECT s FROM SimCardHistory as s"
    )
    public class SimCardHistory extends History {
    
      private int slotNumber = -1;
    
      
      @Column(name="slotnumber")
      public int getSlotNumber() {
        return slotNumber;
      }
    
      public void setSlotNumber(int slotNumber) {
        this.slotNumber = slotNumber;
      }
      
    }

    Code:
    @MappedSuperclass
    public abstract class History {
    
      private long id;
      private String serialNumber;
      private long connectionDate;
      private Device device;
      
      @Id
      @GeneratedValue
      @Column(name="id")
      public long getId() {
        return id;
      }
    
      public void setId(long id) {
        this.id = id;
      }
    
      @Column(name="serialnumber")
      public String getSerialNumber() {
        return serialNumber;
      }
      
      public void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
      }
      
      @Column(name="connectiondate")
      public long getConnectionDate() {
        return connectionDate;
      }
      public void setConnectionDate(long connectionDate) {
        this.connectionDate = connectionDate;
      }
    
      @ManyToOne
      @JoinColumn(name="device_id")
      public Device getDevice() {
        return device;
      }
    
      public void setDevice(Device device) {
        this.device = device;
      }
      
    }

  • #2
    Sorry, I find it.

    Code:
    @Entity
    @Table(name="simcardhistory")
    @NamedQuery(
        name="findSimCardHistory",
        query="SELECT s FROM SimCardHistory as s"
    )
    public class SimCardHistory extends History {
    
      private int slotNumber = -1;
    
      
      @Column(name="slotnumber")
      public int getSlotNumber() {
        return slotNumber;
      }
    
      public void setSlotNumber(int slotNumber) {
        this.slotNumber = slotNumber;
      }
      
    }

    Comment

    Working...
    X