##### Java.com
I. Annotations
II.Md5 Hashing
III.Hibernate ( dialect )
#LIST OF ANNOTATIONS ('@')
1.@all to suppress all warnings
2.@boxing to suppress warnings relative to boxing/unboxing operations
3.@cast to suppress warnings relative to cast operations
4.@dep-ann to suppress warnings relative to deprecated annotation
5.@deprecation to suppress warnings relative to deprecation
6.@fallthrough to suppress warnings relative to missing breaks in switch statements
7.@finally to suppress warnings relative to finally block that don’t return
8.@hiding to suppress warnings relative to locals that hide variable
9.@incomplete-switch to suppress warnings relative to missing entries in a switch statement (enum case)
10.@nls to suppress warnings relative to non-nls string literals
11.@null to suppress warnings relative to null analysis
12.@rawtypes to suppress warnings relative to un-specific types when using generics on class params
13.@restriction to suppress warnings relative to usage of discouraged or forbidden references
14.@serial to suppress warnings relative to missing serialVersionUID field for a serializable class
15.@static-access to suppress warnings relative to incorrect static access
16.@synthetic-access to suppress warnings relative to unoptimized access from inner classes
17.@unchecked to suppress warnings relative to unchecked operations
18.@unqualified-field-access to suppress warnings relative to field access unqualified
19.@unused to suppress warnings relative to unused code
| Hibernate | |
| what is dialect? | |
| Dialect is an English word that means variant of a language. For example, there are multiple dialects of English. For example, British English and American English. | |
| In the context of databases, people talk about dialects of SQL. SQL is the main language just as English is. Then there are dialects with database specific syntax. For example, Oracle has the rownum keyword. |
| // Using this class we can genarate md5 hash for any string | |
| //http://howtodoinjava.com/2013/07/22/how-to-generate-secure-password-hash-md5-sha-pbkdf2-bcrypt-examples/ | |
| // md5.java | |
| package com.ngtest; | |
| import java.security.MessageDigest; | |
| import java.security.NoSuchAlgorithmException; | |
| public class Md5Hashing | |
| { | |
| public static void main(String[] args) | |
| { | |
| String passwordToHash = "password"; | |
| String generatedPassword = null; | |
| try { | |
| // Create MessageDigest instance for MD5 | |
| MessageDigest md = MessageDigest.getInstance("MD5"); | |
| //Add password bytes to digest | |
| md.update(passwordToHash.getBytes()); | |
| //Get the hash's bytes | |
| byte[] bytes = md.digest(); | |
| //This bytes[] has bytes in decimal format; | |
| //Convert it to hexadecimal format | |
| StringBuilder sb = new StringBuilder(); | |
| for(int i=0; i< bytes.length ;i++) | |
| { | |
| sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1)); | |
| } | |
| //Get complete hashed password in hex format | |
| generatedPassword = sb.toString(); | |
| } | |
| catch (NoSuchAlgorithmException e) | |
| { | |
| e.printStackTrace(); | |
| } | |
| System.out.println(generatedPassword); | |
| } | |
| } |