Struts2 Hibernate (возвращает список, в результате чего Hibernate извлекает данные из всех отношений) - PullRequest
1 голос
/ 31 июля 2010

Я создаю зависимые выпадающие списки, используя Struts2 jquery. Проблема в том, что метод getLobList () внутри класса действия вызывает hibernate для получения всех данных для объекта. Если я удаляю этот метод получения, эти журналы не создаются. Почему это происходит, чтобы это исправить?

JSP страница

<s:url id="remoteurl" action="getLists"/> 
<sj:select 
 href="%{remoteurl}" 
 id="lob" 
 onChangeTopics="reloadsecondlist" 
 name="lobId" 
 list="lobList"
 listKey="lobId"
 listValue="lobDescription"
 headerKey="-1" 
 headerValue="Please Select a Line of Business"
/>

Класс действия

public class CreateRequest extends BaseAction {

 private List<Lob> lobList;
 private Integer lobId;

 public String execute() {
  lobList = services.getLobs();
  return SUCCESS;
 }

 public void setLobId(Integer lobId) {
  this.lobId = lobId;
 }
 /* PROBLEM */
 public List<Lob> getLobList() {
  return lobList;
 }

}

Lob.java

@Entity
@Table(name = "lob")
public class Lob implements java.io.Serializable {

 private Integer lobId;
 private String lobDescription;
 private List<Application> applications;

 public Lob() {
 }

 public Lob(String lobDescription) {
  this.lobDescription = lobDescription;
 }

 @Id
 @GeneratedValue(strategy = IDENTITY)
 @Column(name = "lob_id", unique = true, nullable = false)
 public Integer getLobId() {
  return this.lobId;
 }

 public void setLobId(Integer lobId) {
  this.lobId = lobId;
 }

 @Column(name = "lob_description", nullable = false, length = 100)
 public String getLobDescription() {
  return this.lobDescription;
 }

 public void setLobDescription(String lobDescription) {
  this.lobDescription = lobDescription;
 }

 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "lob")
 public List<Application> getApplications() {
  return this.applications;
 }

 public void setApplications(List<Application> applications) {
  this.applications = applications;
 }
}

Application.java

@Entity
@Table(name = "application")
public class Application implements java.io.Serializable {

    private Integer applicationId;
    private Lob lob;
    private String applicationMnemonic;
    private String applicationName;
    private List<Cta> ctas;
    private List<Request> requests;
    private List<Environment> environments;

    public Application() {
    }

    public Application(Lob lob, String applicationMnemonic, String applicationName) {
        this.lob = lob;
        this.applicationMnemonic = applicationMnemonic;
        this.applicationName = applicationName;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "application_id", unique = true, nullable = false)
    public Integer getApplicationId() {
        return this.applicationId;
    }

    public void setApplicationId(Integer applicationId) {
        this.applicationId = applicationId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "lob_id", nullable = false)
    public Lob getLob() {
        return this.lob;
    }

    public void setLob(Lob lob) {
        this.lob = lob;
    }

    @Column(name = "application_mnemonic", nullable = false, length = 10)
    public String getApplicationMnemonic() {
        return this.applicationMnemonic;
    }

    public void setApplicationMnemonic(String applicationMnemonic) {
        this.applicationMnemonic = applicationMnemonic;
    }

    @Column(name = "application_name", nullable = false, length = 100)
    public String getApplicationName() {
        return this.applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinTable(name = "application_cta", catalog = "etech", joinColumns = {
        @JoinColumn(name = "application_id", nullable = false, updatable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "cta_id", nullable = false, updatable = false)})
    public List<Cta> getCtas() {
        return this.ctas;
    }

    public void setCtas(List<Cta> ctas) {
        this.ctas = ctas;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "application")
    public List<Request> getRequests() {
        return this.requests;
    }

    public void setRequests(List<Request> requests) {
        this.requests = requests;
    }

    @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinTable(name = "application_environment", catalog = "etech", joinColumns = {
        @JoinColumn(name = "application_id", nullable = false, updatable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "environment_id", nullable = false, updatable = false)})
    public List<Environment> getEnvironments() {
        return this.environments;
    }

    public void setEnvironments(List<Environment> environments) {
        this.environments = environments;
    }
}

Журнал сервера

2010-07-30 23:10:36,340 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select applicatio0_.lob_id as lob4_1_, applicatio0_.application_id as applicat1_1_, applicatio0_.application_id as applicat1_4_0_, applicatio0_.application_mnemonic as applicat2_4_0_, applicatio0_.application_name as applicat3_4_0_, applicatio0_.lob_id as lob4_4_0_ from etech.application applicatio0_ where applicatio0_.lob_id=?
2010-07-30 23:10:36,350 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,351 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,352 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,353 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,354 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,355 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,356 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,356 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,357 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,358 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,359 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,360 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,361 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,361 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,362 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,363 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,363 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,364 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,364 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,365 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,365 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,366 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,366 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,367 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,367 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,368 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,368 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,369 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select ctas0_.application_id as applicat1_1_, ctas0_.cta_id as cta2_1_, cta1_.cta_id as cta1_7_0_, cta1_.cta_description as cta2_7_0_ from etech.application_cta ctas0_ left outer join etech.cta cta1_ on ctas0_.cta_id=cta1_.cta_id where ctas0_.application_id=?
2010-07-30 23:10:36,369 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select environmen0_.application_id as applicat1_1_, environmen0_.environment_id as environm2_1_, environmen1_.environment_id as environm1_6_0_, environmen1_.environment_description as environm2_6_0_ from etech.application_environment environmen0_ left outer join etech.environment environmen1_ on environmen0_.environment_id=environmen1_.environment_id where environmen0_.application_id=?
2010-07-30 23:10:36,370 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select requests0_.application_id as applicat5_1_, requests0_.request_id as request1_1_, requests0_.request_id as request1_1_0_, requests0_.application_id as applicat5_1_0_, requests0_.cta_id as cta6_1_0_, requests0_.date_completed as date2_1_0_, requests0_.date_created as date3_1_0_, requests0_.assignee_employee_id as assignee7_1_0_, requests0_.assigner_emploee_id as assigner8_1_0_, requests0_.creator_employee_id as creator9_1_0_, requests0_.request_status as request10_1_0_, requests0_.statement_of_work as statement4_1_0_ from etech.request requests0_ where requests0_.application_id=?
2010-07-30 23:10:36,370 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select applicatio0_.lob_id as lob4_1_, applicatio0_.application_id as applicat1_1_, applicatio0_.application_id as applicat1_4_0_, applicatio0_.application_mnemonic as applicat2_4_0_, applicatio0_.application_name as applicat3_4_0_, applicatio0_.lob_id as lob4_4_0_ from etech.application applicatio0_ where applicatio0_.lob_id=?
2010-07-30 23:10:36,371 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select applicatio0_.lob_id as lob4_1_, applicatio0_.application_id as applicat1_1_, applicatio0_.application_id as applicat1_4_0_, applicatio0_.application_mnemonic as applicat2_4_0_, applicatio0_.application_name as applicat3_4_0_, applicatio0_.lob_id as lob4_4_0_ from etech.application applicatio0_ where applicatio0_.lob_id=?
2010-07-30 23:10:36,371 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select applicatio0_.lob_id as lob4_1_, applicatio0_.application_id as applicat1_1_, applicatio0_.application_id as applicat1_4_0_, applicatio0_.application_mnemonic as applicat2_4_0_, applicatio0_.application_name as applicat3_4_0_, applicatio0_.lob_id as lob4_4_0_ from etech.application applicatio0_ where applicatio0_.lob_id=?
2010-07-30 23:10:36,372 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select applicatio0_.lob_id as lob4_1_, applicatio0_.application_id as applicat1_1_, applicatio0_.application_id as applicat1_4_0_, applicatio0_.application_mnemonic as applicat2_4_0_, applicatio0_.application_name as applicat3_4_0_, applicatio0_.lob_id as lob4_4_0_ from etech.application applicatio0_ where applicatio0_.lob_id=?
2010-07-30 23:10:36,374 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select applicatio0_.lob_id as lob4_1_, applicatio0_.application_id as applicat1_1_, applicatio0_.application_id as applicat1_4_0_, applicatio0_.application_mnemonic as applicat2_4_0_, applicatio0_.application_name as applicat3_4_0_, applicatio0_.lob_id as lob4_4_0_ from etech.application applicatio0_ where applicatio0_.lob_id=?
2010-07-30 23:10:36,374 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select applicatio0_.lob_id as lob4_1_, applicatio0_.application_id as applicat1_1_, applicatio0_.application_id as applicat1_4_0_, applicatio0_.application_mnemonic as applicat2_4_0_, applicatio0_.application_name as applicat3_4_0_, applicatio0_.lob_id as lob4_4_0_ from etech.application applicatio0_ where applicatio0_.lob_id=?
2010-07-30 23:10:36,375 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-1) Hibernate: select applicatio0_.lob_id as lob4_1_, applicatio0_.application_id as applicat1_1_, applicatio0_.application_id as applicat1_4_0_, applicatio0_.application_mnemonic as applicat2_4_0_, applicatio0_.application_name as applicat3_4_0_, applicatio0_.lob_id as lob4_4_0_ from etech.application applicatio0_ where applicatio0_.lob_id=?

Ответы [ 2 ]

1 голос
/ 03 августа 2010

Я столкнулся с той же проблемой.

Это происходит потому, что плагин JSON, отвечающий за создание вашего результата JSON, пытается сериализовать весь объект со всеми его связями.

Чтобы предотвратить это, я предлагаю вам создать оболочку для ваших данных (то есть вы создаете класс LobJSONWrapper, содержащий ТОЛЬКО ключ и значение, которое вы хотите использовать), и возвращаете список экземпляров оболочки вместо Lob экземпляров.

Вы также можете запретить плагину JSON сериализовать поле: см. «Исключение свойств» здесь

0 голосов
/ 12 июля 2011

вам просто нужно удалить ваш сервисный объект из результирующего объекта, для этого вам нужно написать код для отображения действий.

<param name="excludeMethods">serviceObject</>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...