DevOps 应用集

月度归档: 2019 年 11 月

利用EclipseLink 输出jpa sql

Posted on 27 11 月, 201927 11 月, 2019 by admin
//java code如下

       TypedQuery<?> outputSql = entityManager.createQuery(query);

        org.eclipse.persistence.sessions.Session session = communityEm.unwrap(org.eclipse.persistence.jpa.JpaEntityManager.class).getActiveSession();

        org.eclipse.persistence.queries.DatabaseQuery databaseQuery = outputSql.unwrap(org.eclipse.persistence.jpa.JpaQuery.class).getDatabaseQuery();

        databaseQuery.prepareCall(session, new org.eclipse.persistence.sessions.DatabaseRecord());

        System.out.println("databaseQuery.getSQLString()"+databaseQuery.getSQLString());



Posted in JavaLeave a Comment on 利用EclipseLink 输出jpa sql

Idea工具常用快捷键

Posted on 20 11 月, 2019 by admin
  1. 优化 import java classes
//消除不用的 import classes 
Shift+Command + A , then Enter
  1. Find java file
Control + Shift + O
  1. Find keyword in projects
Control + Shift + F
Posted in Idea, JavaTagged Idea, javaLeave a Comment on Idea工具常用快捷键

Mave/git issue fixed 例子

Posted on 18 11 月, 201918 11 月, 2019 by admin
  • 当 maven compile code时, 下载很多的resource files时, 怎样略过如下
mvn clean compile -o install
  • 开发免不了进行代码review,当遇到git提交出现 ‘Changes not staged for commit’ 问题的解决方法
    Cases are
    1) when pull from remote branch1
    2) Modify and submit, then push to remote branch2
    3) Remote branch2 updated some files, and local branch modified
    4) Cant submit and push to remote branch2 now

Solution steps:
1) Check out new local branch from remote branch2
2) Modify new local branch and submit & push to remote branch2
3) After merge to remote branch1(e.g. master branch), remove old local branch and checkout from remote branch
4) Remove the local branch which pushes to remote branch2

Posted in Git, MavenLeave a Comment on Mave/git issue fixed 例子

用java JPA进行多表join

Posted on 14 11 月, 201914 11 月, 2019 by admin

例如我们有如下多表查询

select A.id, A.name, B.name2, C.name2 from A,B,C where A.id=B.bid and B.name3 = C.id 

我们用Join连接 JPA tables

//    Root rootpath   Entity A,B,C  in B has relasionship B.name3 = C     Join b_path = rootpath.join("id");  
Join c_path = b_path.join("name3");
Posted in JavaTagged java, jpaLeave a Comment on 用java JPA进行多表join

Java 小知识

Posted on 14 11 月, 201914 11 月, 2019 by admin

1. Get client timezone

Calendar.getInstance().getTimeZone()

2. JPA sql 输出

//queryType:TypedQuery 
System.out.println(queryType.unwrap(org.eclipse.persistence.jpa.JpaQuery.class).getDatabaseQuery().getSQLString());


3. LocalDateTime to Date

//local_time : LocalDateTime
Date.from( local_time.atZone( ZoneId.systemDefault()).toInstant());

Posted in JavaTagged javaLeave a Comment on Java 小知识

文章导航

较旧文章

近期文章

  • Oracle表中字段为timestamp值转化为date显示的sql语句
  • 解决idea环境代码保存后不能实时编译的问题
  • 自定义XStream fields序列化顺序
  • Oracle 修改blob为clob,clob为blob
  • Apple Script: 备份Mac Notes到PDFs

近期评论

    归档

    • 2021 年 2 月
    • 2020 年 8 月
    • 2020 年 7 月
    • 2020 年 1 月
    • 2019 年 11 月
    • 2019 年 5 月
    • 2019 年 3 月
    • 2019 年 2 月
    • 2018 年 12 月

    分类

    • Apple Script
    • docker
    • Git
    • gRPC
    • Hana
    • Idea
    • Java
    • Jenkins
    • Linux
    • Maven
    • Mockito
    • Oracle
    • Selenium
    • Sona
    • SpringBoot
    • Tomcat
    • Uncategorized
    • VirtualBox
    • VMWare
    • VPN
    • XML

    其他操作

    • 登录
    • 条目 feed
    • 评论 feed
    • WordPress.org

    bidvertiser

    Powered by DoHints.cn