Basics of Hibernate Basics

Configuration (C)

  1. An instance of configuration allow the application to specify the properties and mapping documents necessary to build Session Factory.
  2. Usually an application will create a single Configuration. Build a single instance of Session Factory.
  3. The configuration is meant to be an initialization-time object

Session Factory (I)

  1. Immutable
  2. Thread safe
  3. Usually an application has a single session factory instance per database
  4. Main purpose is to obtain session from it.

Session (I)

  1. Short lived
  2. Not thread safe.
  3. Its better to create a new session for each new request
  4. It represents a conversation between and application and database.

Transaction (I)

  1. Short lived
  2. Not thread safe
  3. It represents atomic units of work.
Posted in Hibernate, Uncategorized | Tagged , , | Leave a comment

Encapsulation Vs Abstraction – revisited

OOPs Concepts

  1. Inheritance
  2. Polymorphism
  3. Abstraction
  4. Encapsulation

The first two Inheritance and polymorphism has been pretty straight to understand,

  1. Inheritance à the child class get the properties of the parent class, and so on
  2. Polymorphism -> the object behaves differently in different situations basically polymorphic, it can be achieved by over loading and with help of inheritance and overriding concepts.

Coming to the Abstraction and encapsulation, they both are bit confusing.

Both are telling to hide some information. But ways are different.

  1. Encapsulation suggests to hides the information by restricting the access of the class, methods, members.

whereas

  1. Abstraction suggests to hides the information, (actual implementation of the objects behaviour) By using the Interfaces and abstract classes to show the behaviours (public methods) and you implement them in concrete classes. So that the client only sees the public methods, you can always improve the concrete implementations in later versions.

What are the advantages we get if we follow Oops principles?

Well you can develop better software.

  • Flexibility – always possible to provide more advance implementations
  • Modular – so parallel development possible, easy to debug without effecting other modules
  • Easy to maintain
  • Makes easy for performance tuning
  • Code reusability
  • The entire system mail fail but the individual module may work properly so we can always make things right.
Posted in java, Uncategorized | Tagged , , | Leave a comment

Key takeaways from Trisha gee’s  GoTo 2013 career advice for programmers

Most of you already know who Trisha Gee is.  She is one of my favorite Developer. I have been watching her talks lately and thought of noting down the key takeaways.

You can watch full video here

 

Below are the some of points I have noted down from her GOTO 2013 talk.

  1. Only you going to be manage your own career.
  2. you need to invest your own time in your own career.
  3. The more time you invest in pet projects, opensource etc, the less shitty you job is, because these will help you landing in better jobs.
  4. If you really want most of your life, you need steer it in a non drunken fashion.
  5. Be different and stand out, you have to have something which makes you different (like CV, GitHub, blog, etc).
  6. If you have to have your  CV in PDF.
  7. One of the things you should do is , rephrase your work experience so that it looks like your new role.
  8. Invest in building your CV, so that it would stand out.
  9. As an Engineer we are kind of liked to be a bit more factual.
  10. The key to be in technical is to “stay ahead of the curve”
  11. You don’t need to be an expert in all things, Be an expert enough on the stuff you need to know.
  12. Internal visibility
    1. Work on popular project in your office
    2. Networking
  13. External visibility
    1. Work for popular company
    2. Working on a famous project
    3. Contributing to open source projects
    4. GitHub
    5. Writing a Blog
    6. Writing a Book
    7. etc
  14. You need to know who is the person that you need to market yourself to.
  15. Don’t put all technologies you have learnt in your CV.

You can follow Trisha

  1. Blog – https://trishagee.github.io/
  2. Twitter – @trisha_gee
  3. or else you can google about her.
Posted in Uncategorized | Leave a comment

Dreams-blogs-mentors

I have been working as a software developer since last 3 years, A lot of things happened in these past 3 years.

During my course,

  • I wanted to become “world class” developer.
  • I wanted to travel at least 3 countries.
  • I wanted to work for top companies.
  • I wanted to see my self as a “The Solution Provider”.
  • I wanted to have a huge salary package.

All these are served me as great motivators.

With all these wishes and ambitions I started my career, putting my head into all the technologies and all the projects, surfing on the internet for latest tech and trends….getting complements from my managers… All is well,

Now the time has come. ” THE PERFORMANCE REVIEW ”

Every body know what happens in side the cabin. (if you don’t know read my gurus blog posts: http://sivaprasadreddy.com/)

Now there is not that momentum, once there is not much momentum I started to observe my surroundings, what happens around me. then the perfect question comes “Y?”

If you have a mentor, you are the most fortunate person. then i started for a mentor, who can answer all my questions.

The quest begins.  Where to start.?

My quest stared from InfoWorld form there to I landed to Dzone  , great place to read blog post from great people from all around the world.

After some days , One fine day I happen to read a blog post from sivalabs

After reading the blog posts,  I got greatly motivated. I started following him, through his blog posts, tweets, linked in,Github, emails… I used almost all social networking sites 😛

He is like a static Ip for me though which i connected to the world of developers. 😀

From there now I follow great people, great articles.

Here is the some of my favorite blogs

  1. http://sivalabs.in/
  2. https://shekhargulati.com/
  3. https://trishagee.github.io/
  4. http://www.baeldung.com/
  5. https://www.thoughts-on-java.org/

I was grateful to http://sivalabs.in/ ,  for being my mentor.

The ladder of success is best climbed by stepping on the rungs of opportunity.
-Ayn Rand

Thanks for all the great people, who blog their thoughts, those will  become stepping stones for young people like me.

Posted in Uncategorized | 1 Comment

The Journey starts

Today’s post is not related to Technology. Today I just want to share some thoughts and plans I wanted to execute and terribly failed and still failing.

Spoiler alert: this post contain my random thoughts. And the flow of my mind. 

  1. First I always wish to woke up in early morning and do exercise. So in the night I prepare my mind that “from tomorrow I am going to run” but in the morning nothing, as usually sleeping upto 8 P.M and telling myslef that lets try tomorrow. The same routine from the last two year’s. 
  2. The next thing I wanted to travel. I just want to travel a lot. In my childhood I used to think that is there any job that has a lot of traveling I am going to do that. But after my intermediate it’s just gone. It’s been around 8 years my passed my 12th. Now again I am exited about traveling. meanwhile a lot has changed in my life. I wanted travel now, but a just afraid to travel, fear of insecurity. A lot of in security gathered In side me. So in this also I have been failing.
  3. The next important thing is work. I am working in Information Technology. Nice job. there has been a lot of pseudo opinions imposed on me about this field. That made a negative impression. I am coming out of all those false beliefs. But that costed me 2 years of my time.
  4. Coming to family upto now I am pretty much good at maintaining family relationships. I am very good boy. Rama is good boy type. For now family part successful. 
  5. Now the friends and fun part: I don’t know , why I became this much insecure. I was literally afraid to come out of my comfort zone. Most of the times I rejected go out with my friends. Now I regret that I would have gone out. Besides that I got very good friends they gave me freedom.
  6. Coming to fun part. I had a bit of fun too. Most of the fun all I had was with my family. A bit with friends. I wish had spent time with friends also.

    These are the some of my regrets/failures I had. Even though it’s not late, I have plenty of time to change all of those.

    This is for today’s post.

    References: my mind

    Posted in life | Tagged | Leave a comment

    Remove White spaces in String

    public class RemoveWhiteSpacesInString {
    	public static void main(String[] args) {
    		String str = "birds can fly";
    		// using replace all;
    		String strWithoutSpace = str.replaceAll("\\s", "");
    		System.out.println(strWithoutSpace);
    		
    		//Without using replaceAll() method
    		char[] strArray = str.toCharArray();
    		StringBuffer sb = new StringBuffer();
    		for(int i=0; i<strArray.length; i++){
    			if((strArray[i]!= ' ') && (strArray[i] !='\t')){
    				sb = sb.append(strArray[i]);
    			}
    		}
    		System.out.println(sb);  
    	}
    }
    
    Posted in Programing questions | Tagged , | Leave a comment

    Reverse an ArrayList

    import java.util.ArrayList;
    import java.util.List;
    
    /**
     * Java Program to reverse ArrayList in place
     *
     */
    public class ReverseArrayList 
    {
        public static void main( String[] args )
        {
            List<String> listOfFood  = new ArrayList<String>();
            listOfFood.add("Beans");
            listOfFood.add("Soup");
            listOfFood.add("Dark Chocolate");
            listOfFood.add("Yogurt");
            listOfFood.add("Sausage");
            listOfFood.add("Pure Vegetables");
            listOfFood.add("Nuts");
            
            System.out.println("Origibal Array : "+ listOfFood);
            
            int size = listOfFood.size();
            
            for(int i=0 ; i< size/2 ; i++){
            	String tmp = listOfFood.get(i);
            	listOfFood.set(i, listOfFood.get(size-i-1));
            	listOfFood.set(size-i-1, tmp);
            }
            
            System.out.println("Reversed ArrayList : "+ listOfFood);
        }
    }
    
    Posted in Programing questions | Tagged , | Leave a comment