Declaration and Access Control

Posted on Leave a commentPosted in Java

Identifiers identifiers begin with letter, underscore or currency After the first letters, identifiers can contain digits can be any length must be camelCase methods Example of all valid identifier String b, _hello, $holder, number5, reallyreallyreallyreallylongName; Declaration Rules source code file can only have one public class file name must match class name one package statement, […]

Comparable vs Comparator

Posted on Leave a commentPosted in Architect, Java

Purpose: Comparable/Comparator are used to allow comparison of two or more objects. For example you have Person object and you want to add a natural ordering of each person by age. In other words to keep the order of each person from youngest to oldest or vice versa in a ordered collection like TreeSet (There are other ordered […]

Balanced Braces Algorithm

Posted on Leave a commentPosted in Java

Typical problem scenario: For every opening brace (i.e., (, {, or [), there is a matching closing brace (i.e., ), }, or ]) of the same type (i.e., ( matches ), { matches }, and [ matches ]). An opening brace must appear before (to the left of) its matching closing brace. For example, ]{}[ […]

EnumType.Ordinal vs EnumType.STRING

Posted on Leave a commentPosted in Hibernate

How to Map Enum to hibernate class: @Entity @table(“d_user_group”) public class UserGroup { @Enumerated(EnumType.STRING) @Column(name=”user_group_status”) private UserGroupStatusEnum userGroupStatus; public enum UserGroupStatusEnum{ Active, Draft; } } In the case above we have a table d_user_group, that will have a column user_group_status, that only accepts Enum as a parameter. If you specify EnumType.String it will store the […]

Hibernate – A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance

Posted on Leave a commentPosted in Hibernate

Hibernate Class: @Entity @Table(name=”Person”) public class Person{ @OneToMany(mappedBy = “children”, cascade = CascadeType.ALL, orphanRemoval = true) private Set<Child> children; … //setters and getters }   Error occurs when in controller you are trying to set it to null instead of clearing the set/list, the following pseudo code will throw an exception as “A collection with […]

Identity Access Management

Posted on Leave a commentPosted in AWS

IAM (Identity and Access Management) Amazon service that enables you to do the following: Create users Manage users and their access Create Federated User (Temporary Users) Free of charge IAM User Management Create, Delete, List Users Manage group memberships, credentials permissions default 100 groups limit, 5000 users limit Users in this context, Users are individual […]

VPC Peering

Posted on Leave a commentPosted in AWS

Credits to http://aclo What is VPC  Peering?  Connection between two VPCs (single or with other AWS Account) within a single region. This is done via private IP address. Technology used is existing infrastructure of VPC, it is neither a gateway or a VPN connection. Example  VPC Peering: Transitive Peering NOT Supported – VPC A cannot […]