Posts

Showing posts from September, 2015

Spring Hibernate Errors and Solutions

Problem: Hibernate Gives an Error for updating a column with a null value this column is a foreign key    Entity X has a resource in it     @JoinColumn(name = "resource_id", referencedColumnName = "id")     @ManyToOne(optional = false)     private Resource          resource; not-null-property-references-a-null-or-transient-value When the resource is null when we try to update in Hibernate 4.2.2 Final a error is given in Nullability.class if ( checkability[i] && values[i]!= LazyPropertyInitializer.UNFETCHED_PROPERTY ) { final Object value = values[i]; if ( !nullability[i] && value == null ) { //check basic level one nullablilty throw new PropertyValueException( "not-null property references a null or transient value", persister.getEntityName(), persister.getPropertyNames()[i] ); } Solution: Set @ManyToOne(opti...

AWS - RDS - mysql instances

http://serverfault.com/questions/599421/highest-value-of-max-connections-in-aws-rds-micro-instance MODEL max_connections innodb_buffer_pool_size --------- --------------- ----------------------- t1.micro 34 326107136 ( 311M) m1-small 125 1179648000 ( 1125M, 1.097G) m1-large 623 5882511360 ( 5610M, 5.479G) m1-xlarge 1263 11922309120 (11370M, 11.103G) m2-xlarge 1441 13605273600 (12975M, 12.671G) m2-2xlarge 2900 27367833600 (26100M, 25.488G) m2-4xlarge 5816 54892953600 (52350M, 51.123G) show variables like 'max_connect_errors' Blocked because of many connection errors many connection error org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session  for   transaction; nested exception is org.hibernate.exception.GenericJDBCEx...

AWS Certified Solution Architect

AWS Certification - Solution Architect Things to Know - http://en.wikipedia.org/wiki/List_of_DNS_record_types CNAME record - (Canonical Name record) - (http://en.wikipedia.org/wiki/CNAME_record) is a type of resource record in the Domain Name System(DNS) used to specify that a domain name uses the IP addresses of another domain, the "canonical" domain. ftp.example.com  ------> www.example.com  ------>      A record (example.com) -----> IP Address If you need to change the IP-address you only need to change at one place (A record) CNAME records must always be pointed to another domain name and never to an IP-address bar.example.com CNAME foo.example.com foo.example.com A     192.168.1.1 bar is pointing to a CNAME record of foo.example.com, foo inturn is pointing to IP address 192.168.1.1 foo is the actual Canonical Name (CNAME) of bar, bar is an alias for the Right hand side (RDATA portion) which is a canonical name. DN...

Emailing using AWS

Configure AWS Keys as follows on your properties file or AWS variables, AWS_ACCESS_KEY_ID = AWS_SECRET_KEY = Configure Email Parameters, FROM_EMAIL = noreply@aaaa.com SMTP_USER = AAAA SMTP_PASSWORD = AAAA SMTP_HOST = email-smtp.us-east-1.amazonaws.com SMTP_PORT = 25 Configure servlet.xml as follows for the EmailUtil       <bean id="emailUtil" class="com.EmailUtil"> <constructor-arg value="${FROM_EMAIL}" /> <constructor-arg value="${SMTP_USER}" /> <constructor-arg value="${SMTP_PASSWORD}" /> <constructor-arg value="${SMTP_HOST}" /> <constructor-arg value="${SMTP_PORT}" /> <constructor-arg value="${AWS_ACCESS_KEY_ID}" /> <constructor-arg value="${AWS_SECRET_KEY}" /> </bean> The EmailUtil can be as follows, import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.BasicAWS...

Learning C# - Clean coding

eg: class Test {   static void Main(){     System.console.WriteLine(“Welcome to C# Training”);   } } http://programmers.stackexchange.com/questions/133015/private-variable-vs-property When setting a value to a variable inside of a class most of the time we are presented with two options: private string myValue; public string MyValue { get { return myValue; } set { myValue = value; } } Is there a convention that determines how we should assign values to variables inside of our classes? I would take it a step further, and bring it to 3 cases. Although there are variations on each, this is the rules I use the majority of the time when C# programming. In case 2&3, always go to the Property Accessor (not the field variable). And in case 1, you are saved from even having to make this choice. 1.) Immutable property (passed in to constructor, or created at construction time). In this case, I use a field variab...