报错之There is no getter for property named ‘Car‘ in ‘class entity.shopCar‘

在这里插入图片描述

package entity;

public class Car {
	
	private int cid;
	private String cname;
	private String cbrand;
	private double cprice;
	private double csellprice;
	private int ccount ;
	private int cstate;
	
	
	public Car() {
		super();
	}




	public Car(String cname, String cbrand, double cprice, double csellprice, int ccount, int cstate) {
		super();
		this.cname = cname;
		this.cbrand = cbrand;
		this.cprice = cprice;
		this.csellprice = csellprice;
		this.ccount = ccount;
		this.cstate = cstate;
	}
	



	public Car(int cid, String cname, String cbrand, double cprice, double csellprice, int ccount, int cstate) {
		super();
		this.cid = cid;
		this.cname = cname;
		this.cbrand = cbrand;
		this.cprice = cprice;
		this.csellprice = csellprice;
		this.ccount = ccount;
		this.cstate = cstate;
	}




	public int getCid() {
		return cid;
	}



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



	public String getCname() {
		return cname;
	}



	public void setCname(String cname) {
		this.cname = cname;
	}



	public String getCbrand() {
		return cbrand;
	}



	public void setCbrand(String cbrand) {
		this.cbrand = cbrand;
	}



	public double getCprice() {
		return cprice;
	}



	public void setCprice(double cprice) {
		this.cprice = cprice;
	}



	public double getCsellprice() {
		return csellprice;
	}



	public void setCsellprice(double csellprice) {
		this.csellprice = csellprice;
	}



	public int getCcount() {
		return ccount;
	}



	public void setCcount(int ccount) {
		this.ccount = ccount;
	}



	public int getCstate() {
		return cstate;
	}



	public void setCstate(int cstate) {
		this.cstate = cstate;
	}



	@Override
	public String toString() {
		return "Car [cid=" + cid + ", cname=" + cname + ", cbrand=" + cbrand + ", cprice=" + cprice + ", csellprice="
				+ csellprice + ", ccount=" + ccount + ", cstate=" + cstate + "]";
	}
	
	
	
	
	

}

```我的实体类2需要查将Car表作为属性连接查询【注意看我的Car car 属性名小写】
package entity;

public class shopCar {

	/**
	 * 购物车表包含购物车的id 用户的id 商品车的id 添加购物车商品的数量
	 */
	private int sid;
	private int uid;
	private int cid;
	private int count;
	
	private Car car;
	
	
	
	public shopCar(int sid, int uid, int cid, int count, Car car) {
		super();
		this.sid = sid;
		this.uid = uid;
		this.cid = cid;
		this.count = count;
		this.car = car;
	}


	public shopCar() {
		super();
	}


	public shopCar(int uid, int cid, int count) {
		super();
		this.uid = uid;
		this.cid = cid;
		this.count = count;
	}


	public shopCar(int sid, int uid, int cid, int count) {
		super();
		this.sid = sid;
		this.uid = uid;
		this.cid = cid;
		this.count = count;
	}



	public Car getCar() {
		return car;
	}

	public void setCar(Car car) {
		this.car = car;
	}

	public int getSid() {
		return sid;
	}


	public void setSid(int sid) {
		this.sid = sid;
	}


	public int getUid() {
		return uid;
	}


	public void setUid(int uid) {
		this.uid = uid;
	}


	public int getCid() {
		return cid;
	}


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


	public int getCount() {
		return count;
	}


	public void setCount(int count) {
		this.count = count;
	}


	@Override
	public String toString() {
		return "shopCar [sid=" + sid + ", uid=" + uid + ", cid=" + cid + ", count=" + count + ", car=" + car + "]";
	}


}
【我的映射文件注意看:属性名Car】
<!-- 查询购物车表 -->
	<resultMap type="entity.shopCar" id="map1">
	
			<result property="sid" column="sid"/>
			<result property="count" column="count"/>
			
		<association property="*Car*" javaType="entity.Car">
			<result property="cbrand" column="cbrand"/>
			<result property="cprice" column="cprice"/>
		</association>
	
	</resultMap>
	<select id="selectShopDateAll" resultMap="map1">
	
		select s.sid,s.count,c.cbrand,c.cprice from shopcar s
		inner join car c on s.cid=c.cid
		where uid=#{uid}
	
	</select>
才会出现这样的错误
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值