Announcement Announcement Module
Collapse
No announcement yet.
SQLGrammarException for Unmapped Properties Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQLGrammarException for Unmapped Properties

    hi,
    i am facing SQLGrammarException while getting Entity from DB, actually i have few properties witch are not mapped with column names, and at loading object the system throws the Exception.

    WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 1054, SQLState: 42S22>
    ERROR [org.hibernate.util.JDBCExceptionReporter] - <Unknown column this_.cityAsString' in 'field list'>
    org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.java:67)

    My class code is like,

    @Entity
    @Table(name = "RETAILER")
    public class RetailerEntity extends MobexEntity implements IRetailerEntity {

    private static final long serialVersionUID = 1L;
    private Long id;
    private Long bankId;
    private String cityAsString = null;

    @Column(name = "id", nullable = false)
    @Id()
    @OrderBy()
    @GeneratedValue(strategy=GenerationType.AUTO)
    public Long getId() {
    return id;
    }
    public void setId(Long id) {
    this.id = id;
    }

    @Column(name = "BANK_ID")
    public Long getBankId() {
    return bankId;
    }
    public void setBankId(Long bankId) {
    this.bankId = bankId;
    }

    // UnMapped
    public String getCityAsString() {
    return cityAsString;
    }

    public void setCityAsString(String cityAsString) {
    this.cityAsString = cityAsString;
    }
    }

    due scenario i can't make cityAsString as Transient.

    Kindly give me you feedback

    Kashif Bashir

    [email protected]

  • #2
    @Transient
    private String cityAsString = null;

    Comment

    Working...
    X