2010-07-31 35 views
1

我正在使用Struts2 jQuery創建依賴下拉菜單。問題在於action類中的getLobList()方法正在導致hibernate獲取lob的所有數據。如果我刪除了getter方法,那些日誌不會被創建。爲什麼會發生這種情況來修復它?Struts2 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" 
/> 

Action類

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=? 
+0

要使用sj:select,我必須在我的struts.xml中使用json-default,這就是造成這種情況的原因。但問題是我必須使用json的sj:select來工作。它可以修復嗎? – Nish 2010-08-01 19:09:33

回答

1

我遇到了同樣的問題。

發生這種情況的原因是負責創建JSON結果的JSON插件試圖序列化具有所有關係的對象整個

爲了防止這種情況,我建議你爲您的數據(也就是你創建只包含鑰匙,你要使用的值LobJSONWrapper類),並返回封裝實例的列表,而不是創建一個包裝Lob個實例。

您還可以防止JSON插件從序列化的字段:請參閱「排除性」 here

+0

謝謝,塞繆爾! – Nish 2010-08-02 21:11:42

+0

不客氣:) – KeatsPeeks 2010-08-02 21:59:42

0

你只需要從結果對象中刪除你的服務對象,做你需要寫上動作映射代碼。

<param name="excludeMethods">serviceObject</>