又一个DynamicDao

模型如下:

@Entity
public class Topic {
	@Id
	@GeneratedValue
	private int id;
	private String title;
	private Date createdAt;
        .......
}

 

   用法如下:

public interface TopicDao {
	@Find
	Topic find(int id);

	@Find(load = true)
	Topic load(int id);

	@Save
	void save(Topic topic);

	@Delete
	void delete(Topic topic);

	@Query("from Topic where title like ?")
	List<Topic> findByTitle(String title);

	@Query("from Topic")
	List<Topic> findAll(@FirstResult int firstResult, @MaxResults	int maxResults);

	@Query("from Topic where id = ?")
	boolean isExist(int id);

	@Query(value = "delete from Topic where createdAt < ?", update = true)
	int deleteByCreatedAt(Date createdAt);

	@Query("select count(*) from Topic")
	long count();
}

 

然后在配置文件中增加如下代码:

<bean id="topicDao" class="com.dynamicDao.DynamicDaoFactoryBean"
		p:daoInterface="com.dynamicDao.dao.TopicDao">

 

Dynamic Dao-开源 Dynamic Dao是JDBC ORM框架。 它允许使用批注将SQL执行附加到接口方法。 立即下载

相关推荐

国央企创新负责人如何通过平台实现科研成果的快速识别与转化?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

mybatis开发--总结--简要说明

Org.oproject.framework简要说明   一、Oproject动态生成DAO接口实现类框架   用途/好处          通过动态字节码生成技术,我们只需根据预定的规则定义我们的DAO接口,框架将在spring容器加载bean定义时为我们自动生成DAO接口的实现类,并将实现类注入到spring容器中。省去了我们自己编写DAO接口实现类的工作,节约时间,提高开发效率。

vincent 1136

人工智能训练师技能等级认定四级技能考核试卷-样题1

本文为人工智能训练师四级技能考核试卷,包含六个实操考核项目,总分100分,考试时间150分钟。试卷涵盖数据处理、模型训练准备及系统维护等核心技能:1)垃圾分类数据集规范与处理(30分),要求评估数据格式并编写Python处理代码;2)学生成绩数据集分析(20分),涉及数据预处理、可视化及相关性分析;3)数据标注审核(10分),重点审核标注准确性;4)智能数据服务系统维护与优化(40分),包括安全帽数据集的项目创建、数据处理及平台协作。考核强调Python编程、数据处理平台操作及AI工作流程的实践能力。

weixin_42221934的博客 440

iBatis 学习 之一 DAO部分

iBatis作者不喜欢在类前加详尽的说明,批评一下.首先看一下包 com.ibatis.dao.client 1 定义了一个声明式接口 Dao2 一个DaoManager接口,它有一个创建Dao实例的工厂方法:  public Dao getDao(Class type); 是为了将用户自己写的Dao接口与sqlMap实现类解藕,通过在dao.xml中指定二者的映射。   public Dao

青之六号 3163

Claude Code vs Codex实战对比:哪个更适合你的Next.js项目?(含真实案例)

本文通过两个真实的Next.js项目案例,深度对比了Claude Code与Codex在UI实现和业务逻辑构建中的表现。Claude Code在代码质量、设计还原度和架构完整性方面优势明显,适合对可维护性要求高的生产级项目;而Codex则以快速响应和低成本见长,更适合原型开发或内部工具。文章提供了基于项目类型、团队能力和成本效益的详细选择策略。

weixin_29201859的博客 806

BU61580芯片实战:手把手教你配置1553B通信的BC端寄存器(含代码解析)

本文详细解析了BU61580芯片在1553B通信中的BC端寄存器配置方法,包括关键寄存器功能映射、初始化代码解析及回环测试实现。通过实战案例和代码示例,帮助开发者快速掌握1553B通信的核心技术,提升系统稳定性和通信质量。

a1b2c的博客 224

Ibatis-dynamic的用法

在Ibatis中是Ibatis的动态查询条件,根据该属性中所包含的元素进行判断是否执行某一条SQL语句。 1、使用dynamic时 select * from Person表

JAVA架构师成长之路 7906

NSGA-III相关笔记

NSGA-III目录目的区别NSGA-III的算法流程非支配排序详解归一化详解 目录 NSGA-III基于matlab的实现 参考文献 1.An Evolutionary Many-Objective Optimization Algorithm Using Reference-point Based Non-dominated Sorting Approach,Part I: Solving P...

weixin_42555400的博客 1万+

Ibatis动态(dynamic)查询

Ibatis的动态查询使得数据操作变得非常的灵活,下次举出了常用的动态查询的属性信息: Ibatis配置信息 Xml代码 <!--DynamicSql--> <typeAliasalias="Student"type="com.ibatis.Student"/> <typeAli...

weixin_33811539的博客 259

告别概念晕眩:用TC3xx SMU和TLF35584的配置实例,搞懂ASIL D功能安全落地

本文通过英飞凌TC3xx系列MCU的SMU模块与TLF35584电源管理芯片的协同配置实例,详细解析了如何实现符合ASIL D功能安全标准的刹车辅助ECU。文章涵盖SMU报警源配置、响应动作类型、TLF35584的安全状态管理,以及构建完整安全闭环的实践方法,帮助工程师将抽象的安全概念落地为具体设计方案。

weixin_30647065的博客 436

图片数据爬取工具Image-Downloader的安装和使用

文章目录1、python安装2、下载chromedriver并配置3、下载phantomjs并配置.4、安装相关python库5、使用 安装包地址:https://github.com/sczhengyabin/Image-Downloader 下载: 方式一:打开cmd,输入: git clone https://github.com/sczhengyabin/Image-Downloader.git 方式二:打开网址 1、python安装 该数据爬取工具要求python>=3.5,由于

wxplol的博客 6672

ache.ibatis.binding.BindingException: Type interface dynamicDao.dao.UserDao is not known to the Mapp

ache.ibatis.binding.BindingException: Type interface dynamicDao.dao.UserDao is not known to the MapperRegistry. at org.apache.ibatis.binding.MapperRegistry.getMapper(MapperRegistry.java:42)

qq_34057100的博客 1444

ROS2进程内通信:零拷贝Intra-Process原理与实战

Intra-Process通信是ROS2实现低延迟节点间数据交换的核心机制,其本质是通过C++17智能指针与零拷贝共享内存,在同一进程内绕过序列化、系统调用和上下文切换。相比传统DDS跨进程通信,它将`geometry_msgs::Twist`类消息延迟从42μs降至0.8μs,显著提升机器人实时控制性能。该技术并非自动启用,需满足同执行器、QoS严格匹配、内存所有权明确三大约束,适用于机械臂控制、视觉SLAM、图像处理流水线等对端到端延迟敏感的场景。本文聚焦ROS2原生Intra-Process通讯的原理

weixin_30619101的博客 362

爬过的第一个坑

严重: Exception sending context initialized event to listener instance of class com.thinkgem.jeesite.modules.sys.listener.WebContextListener org.springframework.beans.factory.BeanCreationException: Erro...

weixin_34206899的博客 108

YOLOv13添加OREPA模块 准确率提升10.56个点,map提升11.87个点。小目标轻量化

本文提出了一种新的OREPA(Optimal Recursive Edge-Preserving Attention)模块,通过结合递归和边缘保留注意力机制,显著提升了目标检测模型的性能。实验结果表明,添加OREPA模块后,准确率提升了10.56个百分点,mAP提升了11.87个百分点。OREPA模块包含三个核心组件:OREPA1处理特征图并保留边缘信息,Bottleneck_OREPA作为瓶颈模块降低计算量,OREPA类通过堆叠多个Bottleneck_OREPA增强网络表达能力。文章详细介绍了如何将OR

FJN110的博客 2761

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

模仿Warp Dynamic Finder的Hibernate Dynamic Dao

看了Robbin前两天发的那帖,Warp framework - 一个相当有前途的Java轻量级Web开发框架([url]http://www.iteye.com/topic/168780[/url]),让人眼前一亮,特别是基于annotation的warp-dynamic-finder部分给人印象非常深刻,利用它,80%情况下Dao的实现不用去写了,只要定义个interface,加几个annot...

Norther 204

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Mybatis动态sql

1、什么是动态SQL 动态sql是指根据传入的参数数据动态组织sql的技术。 2、goods.xml mybatis动态sql的两种写法:1.使用 where 1=1;2.使用<where>标签 <!--动态sql--> <select id="dynamicSQL" parameterType="java.util.Map" resultType="com.imooc.mybatis.entity.Goods"> select * from t_goo.

a898712940的博客 301

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

看了Warp和Hibernate Dynamic Dao想到的

看过 ROBBIN 老大的[url=http://www.iteye.com/topic/168780]Warp framework - 一个相当有前途的Java轻量级Web开发框架[/url] 和 NORTHER 的[url=http://norther.iteye.com/blog/172265]模仿Warp Dynamic Finder的Hibernate Dynamic Dao[...

iteye_20985的博客 142

注解annotation

1.hibernate注解 声明实体Bean   @Entity public class Flight implements Serializable {   Long id;   @Id   public Long getId() { return id; }   public void setId(Long id) { this.id = id; } }   @En...

0与1的世界 216

ibatis-dynamic的用法

dynamic可以去除第一个prepend=”and”中的字符(这里为and),从而可以帮助你实现一些很实用的功能。具体情况如下:1.使用dynamic1.1 xmlselect * from Person <dynamic prepend="where"> <isNotNull property="name" prepend="and">

勇敢的心的网络笔记 3387

@dynamic关键字的作用

先引用一段apple的解释:   @dynamic   You use the@dynamic keyword to tell the compiler that you will fulfill the API contract implied by a property either by providing method implementations directly or a

kingkong1024的专栏 1万+

List<dynamic>动态类型的分组

之前一直喜欢用动态类型,因为不用提前声明类,用起来很方便。但是这个不能分组,在大神帮助下可以进行如下分组: List<dynamic>list = new List<dynamic> { new {a=1,b="a" }, new {a=1,b="b" }, new {a=2,b="c" }, new {a=2,b="d" } ...

蚂蚁筑巢 3919

mybatis注解实现动态sql

传统情况下,我们使用mybatis,都是通过映射文件获取sql。在这里,我们通过对实体添加注解类,在调用的过程中,通过对实体参数对象和注解类进行解析,获取到动态的sql。 大致流程: 如图,我们创建一个Test类,Test类调用具体的Dao,而Dao通过调用IBatisDaoUtils和DynamicSql工具类获取到动态的sql,从而通过sqlMapClientTemplate实现访

hsgao_water的博客 1万+

@dynamic关键字和@synthesize的作用

1、@dynamic:修饰的属性、其getter和setter方法编译器不会自动生成、必须需要自己实现。如果自己没有实现getter和setter方法、编译时没问题,运行时执行对应的方法(动态绑定)时会导致程序崩溃。 2、@synthesize:修饰的属性、其getter和setter方法编译器会自动生成,不需要自己实现。且指定与属性相对应的成员变量。 3、如果一个属性(@property)没...

Holothurian 1851

mysql 几分钟断开_Linux MySQL数据库连接异常 ,shh连接的数据库主机账户几分钟自动断开一次...

自由充系统部署在10.1.3.124机器上,MySQL数据库部署在10.1.5.215机器上,最近124主机启动日志和error老是报错,隔几分钟就报一次(报错如下文),在测试的时候却能正常使用,就是启动日志老是不停的报错。而且ssh连接215主机的redis账户差不多每3分钟自动断开一次,已经把 my.cnf 设置为了60天,重启还是没用,interactive_timeout=5184000...

weixin_42389478的博客 593
上一篇: :dependent => :delete_all vs :destroy_all
下一篇: hibernate persist() vs save()
StudyWorks
码龄19年 0粉丝 4原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值