Tag Archives: Java

Java Code Quality Control Eclipse Plugins 代码质量控制Eclipse插件

Several Eclipse plugins which can help to improve code quality.  all plugs can find from Eclipse Market. 1.  FindBugs Find potential bugs for you.  “a program which uses static analysis to look for bugs in Java code” 2. eCobertura “eCobertura …

Posted in Java, 软件工程 | Tagged , , | Leave a comment

Using Oracle Auto-Increment/Sequence in Hibernate/MyBatis

(Hibernate) Error 1 : java.sql.SQLSyntaxErrorException: ORA-02289: sequence does not exist Solution: Specify the sequence: package com.liguoliang.jee.vo; /** * Represents Client. * @author Guoliang * */ @Entity @Table (name=”Client”) public class Client { @Id @Column(name=”id”) @SequenceGenerator(name=”my_seq”, sequenceName=”CLIENT_ID_SEQUENCE”) @GeneratedValue(strategy = GenerationType.SEQUENCE ,generator=”my_seq”) …

Posted in Java | Tagged , , , | Leave a comment

Oracle 11 XE & JDBC

How to get Oracle 11 XE for Windows 64? Download the Oracle 11 XE 32 bit and install it. No problem for me ( Win7 64) Forgot the sys password, how to reset? Conn / as sysdba passw system input …

Posted in Java | Tagged , , | Leave a comment

Update Log4j Appender at runtime

import java.io.IOException; import org.apache.log4j.FileAppender; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; /** * Test for adding appender to log4j at runtime. * @author SGSCLGLD * */ public class LogingTest { static Logger log = Logger.getLogger(LogingTest.class); public static void main(String[] args) throws IOException { …

Posted in Java | Tagged , | Leave a comment

Java RSA Key Generation/Encryption/Decryption RSA秘钥生成/加密/解密

Requirement: Generate RSA key pair using Java,  and test encryption/decryption. Source code: package com.rsa; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PrivateKey; import java.security.PublicKey; import javax.crypto.Cipher; public class RSATest { /** * Generate key pair and encrypt/decrypt message. * @param args * …

Posted in Java | Tagged , , | Leave a comment