Skip to main content

Posts

Showing posts from November, 2012

Cryptography

Symmetric Encryption vs Asymmetric Encryption Symmetric Encryption works by encrypting a message file by using a private key. The content can be decrypted using the same private key. If both the parties have the same key then only the message can be encrypted/decrypted. Asymmetric Encryption works with the public key and private key combination.Any message/file encrypted using a public key can only be decrypted using the related private Key. Similarly the message which is encrypted using a private key key can only be decrypted using the related public key. Digital Certificates is  a way of storing the keys and authenticating them through a neutral vendor, like Thawte, Symantec.

Hibernate Locking Strategies

Association Fetching We can fetch the associated entities wither eagerly or lazily. The fetch parameter can be set to FetchType.LAZY or FetchType.EAGER. EAGER tries to use outer join select to retrieve the associated object, while LAZY is triggers a select when the associated object is accessed for the first time. @OneToMany and @ManyToMany are defaulted to LAZY, and @OneToOne and @ManyToOne are defaulted to EAGER. The recommended approach is to use LAZY on all static fetching definitions and override this choice dynamically through JP-QL. JP-QL has a fetch keyword that allows you to override laziness when doing a particular query. This is very useful to improve performance and is decided on a use case to use case basis. Named Queries Though we can write queries in the code, externalizing them makes the code cleaner. - it eases debugging - Named queries are precompiled by Hibernate at start up time. Unfortunately, you lose the type-safety of queries written using the Criteria API.