Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dao.insertWith() 保存错误,dao.insertWith不支持保存集合吗? #1241

Closed
hzl7652 opened this issue Apr 10, 2017 · 1 comment
Closed
Labels

Comments

@hzl7652
Copy link
Contributor

hzl7652 commented Apr 10, 2017

List<Yszw> zws = genZwData();
dao.insertWith(zws, null);`
Exception in thread "pool-1-thread-28" java.lang.RuntimeException: Fail to invoke getter lulu.code_lab.framework.random_bean.bean.Yszw.'getSjs()' <class java.util.ArrayList> because [java.lang.IllegalArgumentException: java.lang.ClassCastException@1d532258]: java.lang.ClassCastException@1d532258
	at org.nutz.lang.Lang.makeThrow(Lang.java:104)
	at org.nutz.lang.eject.EjectByGetter.eject(EjectByGetter.java:31)
	at org.nutz.dao.impl.entity.field.AbstractEntityField.getValue(AbstractEntityField.java:57)
	at org.nutz.dao.impl.link.DoInsertLinkVisitor.visit(DoInsertLinkVisitor.java:22)
	at org.nutz.dao.impl.entity.LinkFieldSet.visit(LinkFieldSet.java:41)
	at org.nutz.dao.impl.entity.NutEntity.visitMany(NutEntity.java:337)
	at org.nutz.dao.impl.NutDao.insertWith(NutDao.java:227)`

@Table("T_YS_ZW")
public class Yszw {
	@Id(auto = false)
	Long PID;
	Long FID;
	String ZH;
	String ZLX;
	Double WD;
	Double JD;
	Date GCSJ_D;
	Timestamp GCSJ_T;
	Long GCSJ_L;
	Integer GCSJ_P_N;
	Integer GCSJ_P_Y;
	Integer GCSJ_P_R;
	Integer GCSJ_P_S;
	Integer GCSJ_P_F;
	Integer GCSJ_P_M;
	@Many(target = Yssj.class, field = "ZWID")
	List<Yssj> sjs;
}

@Table("T_YS_SJ")
public class Yssj {

	@Id(auto = false)
	Long PID;
	Long HCID;
	Long ZWID;
	Double F1;
	Double F2;
	Double F3;
	Double F4;
	Double F5;
	Double F6;
	Double F7;
	Double F8;
	Double F9;
	Double F10;
}

格式不是特别好,看https://nutz.cn/yvr/t/olaenglv60h7qqkmj01g90i96j

@wendal wendal added the FAQ label Apr 10, 2017
@wendal
Copy link
Member

wendal commented Apr 10, 2017

恩, 作为faq吧, 因为@one不好改,暂时观望.

@wendal wendal closed this as completed Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants