1、之前在进行项目的构建时都是使用手工进行文件夹的建立,maven也给我们提供了一个参数archetype,可以用来进行项目骨架的建立。使用maven archetype:generate进行创建:
这样就会自动的帮我们生成好pom.xml、src/main/java、src/test/java等文件。
2、我们也可以在myeclipse中使用maven,在myeclipse中已经集成好了对应的maven,如果使用eclipse的话,需要安装m2eclipse的插件。这里就使用myeclipse进行配置,打开以后,找到window-->preferences-->Maven4MyEclipse,来配置我们的自己的maven和仓库。
配置maven:
配置仓库:
配置完成以后我们就可以直接在myeclipse中新建立一个maven项目了:
这样我们使用到的一些jar包maven就会自动帮我们去下载了。
本文链接:http://www.cnblogs.com/wukong65/p/3319319.html,转载请注明。
开发中遇到的Too high level of nesting for select错误
项目使用了Entity Framework结合Mysql, 遇到了一个非常奇怪的性能问题,一个看起来非常简单的查询通过不了。
报出错误, “Too high level of nesting for select”。
整个查询非常简单,只是从表中取到属于一个集合中的id的数据, 比如从表中取到OfficeId 是1, 2,3,6的数据。
var offices = _officeRepository.GetOffices(filter).ToList();
开始一直认为是Mysql的问题,是不是因为Id太多, mysql性能不好,后来发现问题出在EF的使用上。
实际的查询语句
后来调试,发现实际执行的sql语句是这样的,而不是我预想的in查询,而是翻译成了非常复杂的查询
`Extent1`.`OfficeID`,
`Extent1`.`DoctorPhone`,
`Extent1`.`Name`,
`Extent1`.`RegionID`,
`Extent1`.`PriceTier2`,
`Extent1`.`PriceTier3`,
`Extent1`.`PracticeManagementSoftware`,
`Extent1`.`ServerHost`,
`Extent1`.`ServerLogin`,
FROM `office` AS `Extent1`
WHERE EXISTS(SELECT
1 AS `C1`
FROM (SELECT `UnionAll31`.`C1` FROM (SELECT `UnionAll30`.`C1` FROM (SELECT `UnionAll29`.`C1` FROM
(SELECT `UnionAll28`.`C1` FROM (SELECT `UnionAll27`.`C1` FROM (SELECT `UnionAll26`.`C1` FROM (SELECT `UnionAll25`.`C1` FROM
(SELECT `UnionAll24`.`C1` FROM (SELECT `UnionAll23`.`C1` FROM (SELECT `UnionAll22`.`C1` FROM (SELECT `UnionAll21`.`C1` FROM
(SELECT `UnionAll20`.`C1` FROM (SELECT `UnionAll19`.`C1` FROM (SELECT `UnionAll18`.`C1` FROM (SELECT `UnionAll17`.`C1` FROM
(SELECT `UnionAll16`.`C1` FROM (SELECT `UnionAll15`.`C1` FROM (SELECT `UnionAll14`.`C1` FROM (SELECT `UnionAll13`.`C1` FROM
(SELECT `UnionAll12`.`C1` FROM (SELECT `UnionAll11`.`C1` FROM (SELECT `UnionAll10`.`C1` FROM (SELECT `UnionAll9`.`C1` FROM
(SELECT `UnionAll8`.`C1` FROM (SELECT `UnionAll7`.`C1` FROM (SELECT `UnionAll6`.`C1` FROM (SELECT `UnionAll5`.`C1` FROM
(SELECT `UnionAll4`.`C1` FROM (SELECT `UnionAll3`.`C1` FROM (SELECT `UnionAll2`.`C1` FROM (SELECT `UnionAll1`.`C1` FROM
(SELECT 69 AS `C1` FROM (SELECT 1 AS `X`) AS `SingleRowTable1` UNION ALL SELECT 20 AS `C1` FROM (SELECT 1 AS `X`) AS `SingleRowTable2`) AS `UnionAll1`
UNION ALL SELECT 55 AS `C1` FROM (SELECT 1 AS `X`) AS `SingleRowTable3`) AS `UnionAll2` UNION ALL SELECT 67 AS `C1` FROM (SELECT 1 AS `X`) AS `SingleRowTable4`)
AS `UnionAll3` UNION ALL SELECT 9 AS `C1` FROM (SELECT 1 AS `X`) AS `SingleRowTable5`) AS `UnionAll4` UNION ALL SELECT 51 AS `C1` FROM
(SELECT 1 AS `X`) AS `SingleRowTable6`) AS `UnionAll5` UNION ALL SELECT 59 AS `C1` FROM (SELECT 1 AS `X`) AS `SingleRowTable7`) AS `UnionAll6` UNION ALL
SELECT 18 AS `C1` FROM (SELECT 1 AS `X`) AS `SingleRowTable8`) AS `UnionAll7` UNION ALL SELECT 19 AS `C1` FROM (SELECT 1 AS `X`) AS `SingleRowTable9`) AS `UnionAll8`
UNION ALL SELECT
没有评论:
发表评论