Spring с отображением спящего режима в представление базы данных

1

Я использую hibernate с весной в веб-приложении, и мне нужно получить данные из представления базы данных (Oracle), я создал сопоставление и сделал конфигурацию базы данных весной, но когда я hibernateTemplate.find("From ViewLoginPage") я получаю Пустой список, но представление содержит данные, и нет поля первичного ключа в представлении "Моя карта":

<class name="com.portal.ejb.ViewLoginPage" table="ViewLoginPage" schema="FENDEV">
        <composite-id name="id" class="com.portal.ejb.ViewLoginPageId">
            <key-property name="cid" type="big_decimal">
                <column name="cId" precision="22" scale="0" />
            </key-property>
            <key-property name="ctype" type="string">
                <column name="cType" length="50" />
            </key-property>
            <key-property name="ctag" type="string">
                <column name="cTag" length="50" />
            </key-property>
            <key-property name="ctagAttr" type="string">
                <column name="cTagAttr" length="50" />
            </key-property>
            <key-property name="cvalue" type="string">
                <column name="cValue" length="300" />
            </key-property>
            <key-property name="cparent" type="big_decimal">
                <column name="cParent" precision="22" scale="0" />
            </key-property>
            <key-property name="cdisplayOrder" type="big_decimal">
                <column name="cDisplayOrder" precision="22" scale="0" />
            </key-property>
        </composite-id>
    </class>

и класс pojo, который генерируется из Hibernate Code Generator Plugin

public class ViewLoginPage implements java.io.Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private ViewLoginPageId id;

    public ViewLoginPage() {
    }

    public ViewLoginPage(ViewLoginPageId id) {
        this.id = id;
    }

    public ViewLoginPageId getId() {
        return this.id;
    }

    public void setId(ViewLoginPageId id) {
        this.id = id;
    }

}

public class ViewLoginPageId implements java.io.Serializable {

    private BigDecimal cid;
    private String ctype;
    private String ctag;
    private String ctagAttr;
    private String cvalue;
    private BigDecimal cparent;
    private BigDecimal cdisplayOrder;

    public ViewLoginPageId() {
    }

    public ViewLoginPageId(BigDecimal cid, String ctag, BigDecimal cdisplayOrder) {
        this.cid = cid;
        this.ctag = ctag;
        this.cdisplayOrder = cdisplayOrder;
    }

    public ViewLoginPageId(BigDecimal cid, String ctype, String ctag, String ctagAttr, String cvalue, BigDecimal cparent, BigDecimal cdisplayOrder) {
        this.cid = cid;
        this.ctype = ctype;
        this.ctag = ctag;
        this.ctagAttr = ctagAttr;
        this.cvalue = cvalue;
        this.cparent = cparent;
        this.cdisplayOrder = cdisplayOrder;
    }

    public BigDecimal getCid() {
        return this.cid;
    }

    public void setCid(BigDecimal cid) {
        this.cid = cid;
    }

    public String getCtype() {
        return this.ctype;
    }

    public void setCtype(String ctype) {
        this.ctype = ctype;
    }

    public String getCtag() {
        return this.ctag;
    }

    public void setCtag(String ctag) {
        this.ctag = ctag;
    }

    public String getCtagAttr() {
        return this.ctagAttr;
    }

    public void setCtagAttr(String ctagAttr) {
        this.ctagAttr = ctagAttr;
    }

    public String getCvalue() {
        return this.cvalue;
    }

    public void setCvalue(String cvalue) {
        this.cvalue = cvalue;
    }

    public BigDecimal getCparent() {
        return this.cparent;
    }

    public void setCparent(BigDecimal cparent) {
        this.cparent = cparent;
    }

    public BigDecimal getCdisplayOrder() {
        return this.cdisplayOrder;
    }

    public void setCdisplayOrder(BigDecimal cdisplayOrder) {
        this.cdisplayOrder = cdisplayOrder;
    }

    public boolean equals(Object other) {
        if ((this == other))
            return true;
        if ((other == null))
            return false;
        if (!(other instanceof ViewLoginPageId))
            return false;
        ViewLoginPageId castOther = (ViewLoginPageId) other;

        return ((this.getCid() == castOther.getCid()) || (this.getCid() != null && castOther.getCid() != null && this.getCid().equals(
                castOther.getCid())))
                && ((this.getCtype() == castOther.getCtype()) || (this.getCtype() != null && castOther.getCtype() != null && this.getCtype().equals(
                        castOther.getCtype())))
                && ((this.getCtag() == castOther.getCtag()) || (this.getCtag() != null && castOther.getCtag() != null && this.getCtag().equals(
                        castOther.getCtag())))
                && ((this.getCtagAttr() == castOther.getCtagAttr()) || (this.getCtagAttr() != null && castOther.getCtagAttr() != null && this
                        .getCtagAttr().equals(castOther.getCtagAttr())))
                && ((this.getCvalue() == castOther.getCvalue()) || (this.getCvalue() != null && castOther.getCvalue() != null && this.getCvalue()
                        .equals(castOther.getCvalue())))
                && ((this.getCparent() == castOther.getCparent()) || (this.getCparent() != null && castOther.getCparent() != null && this
                        .getCparent().equals(castOther.getCparent())))
                && ((this.getCdisplayOrder() == castOther.getCdisplayOrder()) || (this.getCdisplayOrder() != null
                        && castOther.getCdisplayOrder() != null && this.getCdisplayOrder().equals(castOther.getCdisplayOrder())));
    }

    public int hashCode() {
        int result = 17;

        result = 37 * result + (getCid() == null ? 0 : this.getCid().hashCode());
        result = 37 * result + (getCtype() == null ? 0 : this.getCtype().hashCode());
        result = 37 * result + (getCtag() == null ? 0 : this.getCtag().hashCode());
        result = 37 * result + (getCtagAttr() == null ? 0 : this.getCtagAttr().hashCode());
        result = 37 * result + (getCvalue() == null ? 0 : this.getCvalue().hashCode());
        result = 37 * result + (getCparent() == null ? 0 : this.getCparent().hashCode());
        result = 37 * result + (getCdisplayOrder() == null ? 0 : this.getCdisplayOrder().hashCode());
        return result;
    }

}

может ли кто-нибудь сказать мне, что эта процедура одинакова для отображения представлений в спящем режиме или я что-то упускаю?

  • 1
    Проблема в том, что сообщение об ошибке, поступающее непосредственно от Oracle, гласит: ORA-00942: table or view does not exist . Hibernate не имеет ничего общего с этим исключением.
  • 1
    @JBNizet Я знаю, но представление существует в базе данных и с использованием sql плюс я могу также запросить его и получить пакет данных, но я думаю, может быть, я что-то упустил в отображении.
Показать ещё 3 комментария
Теги:
spring-mvc
hibernate
spring-data

1 ответ

0

Итак, я наконец решил проблему. В Oracle Database все виды имен находятся в Case Sensitive, что означает его во всех отношениях между двойной цитатой "ViewLoginPage", поэтому после небольшого поиска я нашел это, и все работает как шарм, просто устанавливая имена столбцов в отображениях обратных ViewLoginPage " ViewLoginPage ".

Ещё вопросы

Сообщество Overcoder
Наверх
Меню