p6spy

How to configure p6spy with datasource in Spring + tomcat 7 +MySQL

帅比萌擦擦* 提交于 2019-12-11 07:29:48
问题 I have been trying to configure p3spy logging system on my maven based spring project.But each time when i try to configure p3spy differently. i get always errors. Here is my following settings I placed p6spy-2.3.0.jar, spy.properties and mysql-connector-java-5.1.17.jar inside the tomcat/lib directory. tomcat/context.xml <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" name="jdbc/myDataSource" type="javax.sql.DataSource" url="jdbc:p6spy:mysql://localhost:3306/coexi

Generate a SQL script from Hibernate

冷暖自知 提交于 2019-12-11 03:19:26
问题 I'm using Hibernate 4.3.5-Final for my Java Swing application and I do many UDPATE , INSERT and DELETE with it (in HQL or with Criteria ). Now, what I'm trying to do is to export a SQL script of all modifications done on my database but I don't know how to do that. This script need to contain only the modifications (and not the creation of the tables) and put them on a .sql file (exported file path will be chosen by the user) Do you have any ideas that can solve my problem ? Thank you in

P6SpyDriver cannot be cast to javax.sql.XADataSource exception while trying to configure P6Spy 2.0 with xa-datasource using Jboss AS 7 and potgres

元气小坏坏 提交于 2019-12-11 02:34:09
问题 P6spy v2 has a support for xa datasources - P6spy on github In my jboss AS 7 standalone-full-ha.xml, i have the following datasource configurations. <xa-datasource jndi-name="java:jboss/datasources/MyDS" pool-name="v" enabled="true" use-java-context="true" use-ccm="false"> <xa-datasource-property name="ServerName"> localhost </xa-datasource-property> <xa-datasource-property name="PortNumber"> 5432 </xa-datasource-property> <xa-datasource-property name="DatabaseName"> MyDB </xa-datasource

P6Spy not logging SQL

拜拜、爱过 提交于 2019-12-11 01:22:12
问题 I have a program that updates tables in a database using prepared statements, and I'm trying to see the output of all the SQL statements that are implemented. My research suggested P6Spy which looked great, I downloaded it, added the P6Spy.jar as a dependency in my library, modified to the spy.properties file to connect to use the oracle driver as the realdriver, added the spy.properties to my classpath, and changed the driver to "com.p6spy.engine.spy.P6SpyDriver" in my code. It all works,

hibernate 或者Jpa 报错 java.sql.SQLException: Column ‘列名’ not found 解决

 ̄綄美尐妖づ 提交于 2019-12-06 15:38:49
今天遇到一个很奇怪的问题,就是某一段SQL 在我的电脑里面执行的时候报错了。虽然这段SQL是原生的复杂SQL。 但是在 测试环境那边没有问题啊。而且我看了一下SVN的记录,发现当前版本也没有人改动啊!!怎么就出现了这个问题? 先上异常把 jpa Column 'totalWeight' not found. 反正 出现来堆的SQL最好爆了这个。 因为这个是 分页查询,发现是在 查询总记录数的时候,没有报错。报错的是接下来的 limit分页查询记录。 因为我的本地项目配置了 p6spy 因此可以看到发给MYSQL的 原生SQL SELECT a.id, a.createtime,a.goods_amount, a.order_id,a.order_status,a.totalPrice,a.ziti_name, a.ziti_mobile,b.store_name, b.store_telephone, b.store_ower,c.userName, d.en_name,d.en_ceo,d.en_address,w.total_weight as total_goods_weight, a.borrow_status FROM gwqmshop_order a left join gwqmshop_store b on b.id=a.store_id left join

Spring Data Jpa最佳实践

与世无争的帅哥 提交于 2019-12-04 06:33:26
前言 Spring Data Jpa框架的目标是显著减少实现各种持久性存储的数据访问层所需的样板代码量。Spring Data Jpa存储库抽象中的中央接口是Repository。它需要领域实体类以及领域实体ID类型作为类型参数来进行管理。该接口主要用作标记接口,以捕获要使用的类型并帮助您发现扩展该接口的接口。CrudRepository、JpaRepository是更具体的数据操作抽象,一般我们在项目中使用的时候定义我们的领域接口然后继承CrudRepository或JpaRepository即可实现实现基础的CURD方法了,但是这种用法有局限性,不能处理超复杂的查询,而且稍微复杂的查询代码写起来也不是很优雅,所以下面看看怎么最优雅的解决这个问题。 扩展接口用法 /** * @author: kl @kailing.pub * @date: 2019/11/11 */ @Repository public interface SendLogRepository extends JpaRepository<SendLog,Integer> { /** * 派生的通过解析方法名称的查询 * @param templateName * @return */ List<SendLog> findSendLogByTemplateName(String templateName); /**

Can't achieve working with p6Spy

僤鯓⒐⒋嵵緔 提交于 2019-12-02 10:43:11
问题 I've tried two methods for adding p6Spy feature to my spring used project. Route I, http://templth.blogspot.com.tr/2004/11/integrate-p6spy-with-spring.html I changed my driver with com.p6spy.engine.spy.P6SpyDriver and added realdriver realdriver=com.ibm.db2.jcc.DB2Driver into spy.properties file. But somehow my realdriver is being registered before p6spy driver com.ibm.db2.jcc.DB2Driver is a real driver in spy.properties, but it has been loaded before p6spy. p6spy will not wrap these

Can't achieve working with p6Spy

浪子不回头ぞ 提交于 2019-12-02 05:30:22
I've tried two methods for adding p6Spy feature to my spring used project. Route I, http://templth.blogspot.com.tr/2004/11/integrate-p6spy-with-spring.html I changed my driver with com.p6spy.engine.spy.P6SpyDriver and added realdriver realdriver=com.ibm.db2.jcc.DB2Driver into spy.properties file. But somehow my realdriver is being registered before p6spy driver com.ibm.db2.jcc.DB2Driver is a real driver in spy.properties, but it has been loaded before p6spy. p6spy will not wrap these connections.Either prevent the driver from loading, or try setting 'deregisterdrivers' to true in spy

P6SPY 报错 No suitable driver found

拈花ヽ惹草 提交于 2019-12-01 09:04:26
P6SPY检测Hibernate的运行状况,是很不错的选择。 参考地址: http://my.oschina.net/jiyayun/blog/87078 但是在配置的过程中一直不能正确使用。所以尝试了在非WEB程序下使用,是正常的,但在WEB应用程序下报出 No suitable driver found for jdbc 的错误,这让我纠结了很久。 于 是找遍了网上的资料,基本上都说是三个问题: 一是:连接URL格式出现了问题(Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/XX","root","XXXX") 二是:驱动字符串出错(com.mysql.jdbc.Driver) 三是Classpath中没有加入合适的mysql_jdbc驱动 经过我的仔细检查,这三种错误我都没有犯,为什么呢? 尝试着将mysql-connector-java-3.1.14-bin.jar的jar包加入C:\Program Files\Java\jre1.6.0_02\lib\ext文件夹下,问题解决了!! 原来是不仅仅要求将驱动加入classpath中,而且需要将该jar包加入到java运行环境的外部jar包中! 来源: oschina 链接: https://my.oschina.net/u

Mybatis Plus性能分析

懵懂的女人 提交于 2019-12-01 06:25:03
一、配置 /** * 性能分析 * @return */ @Bean @Profile({"dev","test"}) public PerformanceInterceptor performanceInterceptor (){ PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor(); performanceInterceptor.setFormat(true); performanceInterceptor.setMaxTime(5l); return performanceInterceptor; } 二、添加依赖 <!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations --> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-annotations</artifactId> <version>1.5.20</version> </dependency> <dependency> <groupId>p6spy</groupId> <artifactId>p6spy</artifactId> <version>3.8.4