NutzCN Logo
问答 blob 类型操作
发布于 2958天前 作者 Rekoe 3658 次浏览 复制 上一个帖子 下一个帖子
标签:

如果我的数据是byte[] 类型的
且用 属性

	@Column("dt")
	private Blob config;

那添加数据的时候用

new SimpleBlob(tmp)

只能先转文件这种方式才能操作么

5 回复

@wendal

public PlotConfigEntity add(long uid, int sid, int type, byte[] config) {
		PlotConfigEntity entity = new PlotConfigEntity();
		entity.setUid(uid);
		entity.setType(type);
		File tmp = Jdbcs.getFilePool().createFile(".big");
		Files.write(tmp, config);
		entity.setConfig(new SimpleBlob(tmp));
		return insert(uid, sid, entity);
	}

暴力一点的方式就是自己实现一下Blob接口

@wendal

这个有必要由nutz 提供一个

额,话说还真有

javax.sql.rowset.serial.SerialBlob

@wendal
用这个!

添加回复
请先登陆
回到顶部