首页 > 其他 > 详细

很奇葩的问题

时间:2015-06-22 02:06:18      阅读:341      评论:0      收藏:0      [点我收藏+]

发现一个很奇葩的问题
bubuko.com,布布扣

项目使用hibernate 和spring MVC 开发.

发现改成左边的样子时,tomcat启动时报错,代码如下:?

package com.apidoc.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;

@Entity
@Table(name = "t_api_one")
public class APIOne {
	private int id;
	/***
	 * 接口的访问地址,不包括ip
	 */
	private String url;
	/***
	 * 请求方式:GET,POST,DELETE,PUT
	 */
	private String requestMethod;
	/***
	 * 接口中文名称
	 */
	private String apiName;
	/***
	 * 请求要素
	 */
	private Set<RequestQueryParameter> requestQueryParameters;
	/***
	 * 应答要素
	 */
	private Set<ResponseElement> responseElements;
	/***
	 * 请求的Content-Type
	 */
	private String requestContentType;
	/***
	 * 应答头的Content-Type
	 */
	private String responseContentType;
	private String requestExample;
	private String responseExample;
	/***
	 * 注意事项
	 */
	private String note;
	/***
	 * 预留
	 */
	private String reserved;
	private APIGroup aPIGroup;
	
	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getRequestMethod() {
		return requestMethod;
	}
	public void setRequestMethod(String requestMethod) {
		this.requestMethod = requestMethod;
	}
	public String getApiName() {
		return apiName;
	}
	public void setApiName(String apiName) {
		this.apiName = apiName;
	}
	
	@OneToMany(mappedBy="aPIOne",
			cascade={CascadeType.ALL},
			fetch=FetchType.EAGER)
	@Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
	public Set<RequestQueryParameter> getRequestQueryParameters() {
		return requestQueryParameters;
	}
	public void setRequestQueryParameters(
			Set<RequestQueryParameter> requestQueryParameters) {
		this.requestQueryParameters = requestQueryParameters;
	}
	
	@OneToMany(mappedBy="aPIOne",
			cascade={CascadeType.ALL},
			fetch=FetchType.EAGER)
	@Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
	public Set<ResponseElement> getResponseElements() {
		return responseElements;
	}
	public void setResponseElements(Set<ResponseElement> responseElements) {
		this.responseElements = responseElements;
	}
	public String getRequestContentType() {
		return requestContentType;
	}
	public void setRequestContentType(String requestContentType) {
		this.requestContentType = requestContentType;
	}
	public String getResponseContentType() {
		return responseContentType;
	}
	public void setResponseContentType(String responseContentType) {
		this.responseContentType = responseContentType;
	}
	public String getRequestExample() {
		return requestExample;
	}
	public void setRequestExample(String requestExample) {
		this.requestExample = requestExample;
	}
	public String getResponseExample() {
		return responseExample;
	}
	public void setResponseExample(String responseExample) {
		this.responseExample = responseExample;
	}
	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}
	public String getReserved() {
		return reserved;
	}
	public void setReserved(String reserved) {
		this.reserved = reserved;
	}
	@ManyToOne(cascade = { CascadeType.PERSIST }, fetch = FetchType.EAGER)
	@JoinColumn(name = "api_group_id")
	public APIGroup getaPIGroup() {
		return aPIGroup;
	}
	public void setaPIGroup(APIGroup aPIGroup) {
		this.aPIGroup = aPIGroup;
	}
	
}

?

?

?

?

很奇葩的问题

原文:http://hw1287789687.iteye.com/blog/2221121

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!