I came across the following statement in Java SCJP 6.0 Khalid Mughal.
Note that we can only add an object of a specific type (E). However, a collection
allows us to determine whether it has an element equal to any arbitrary object,
or remove an element that is equal to any arbitrary object.
I tried the following program.
I am not clear as to why the Generics allow Searching/Removing arbitrary object, when in the above case it can only store String.
Why does it fail at System.out.println(node2.getO()), since i am making it clear at line MyNode <String> node2 = new <String> MyNode(10) that it will accept only String, why does it allow me to pass Integer 10 in the constructor.
I understand that creation of session factory is expensive operation. Now assuming that i have an application1 with 10 java bean that are persisted in db and application2 with 100 java beans to be persisted.
In the application1 hibernate1.cfg.xml i have specified the mapping of all the 10 java bean and in application2 hibernate2.cfg.xml i have specified the mapping of all the 100 java beans.
Now in application1, i create a session factory sf1 and in application2 i create a session factory sf2.
Does creation of sf1 requires same amount of resources and is as "expensive" as creation of sf2.
I am trying to figure this out as i have multiple db instance, and multiple session factories are created. I want to merge all these db instance to reduce the overhead of creation of multiple session factories.
I have a working project for spring XA transaction (http://www.javaworld.com/article/2077714/java-web-development/xa-transactions-using-spring.html). I modified the project downloaded and created pom.xml since i had to integrate it with my project. Initially i started with spring 3x. I got it working properly for spring 3x. Now i have to integrate it with hibernate, so in order to create hibernate session factory, i stated migrating it to spring 4x.
i have following entries in my config file for spring 3x
spring config file:
and the pom.xml is having following entry:
This works completely fine. Now if i want to migrate to spring4x, i make the following changes and update my pom.xml as follows:
When i make the above changes and run my program, i get the following error:
Is there any other changes i have to make to get this project working with spring 4x.
I am trying to migrate to spring 4x since i have to make session factory as follows:
I have put my code at dropbox.com/s/734k6l6seji3uk6/XA-Txn-mvn.rar . If you open the rar, the root folder contains MainApp.log. Also there is lib folder containing 3 jars which are required by application. The other jars can be downloaded by using pom.xml.
Hi Folks, I have 10+ extensive java/j2ee experience. I am looking forward to enhancing my skills. Big data/MongoDB is making new and hot in market. I want to learn new skills, but what are the benefits and how does it help in my current market.
Even thought i have set @Transactional(readOnly = true) for insert method, still the insert operation is being performed. Should not the attribute readOnly, which is set to true should take care that insert cannot be performed on this method.
It is a web application. Make sure that the hibernate.cfg.gwt.xml and .class files are in classes folder inside the WEB-INF folder. Try to create structure as follows:
My understanding is that in case of fetch="select", the proxy is loaded so the select query is not being fired. But in case fetch="join" eager loading should take place and select query should be fired immediately when instance is loaded from session. In none of the cases no selet query if fired.
Second level cache is an optional cache and first-level cache(session) will always be consulted before any attempt is made to locate an object in the second-level cache.
Suppose i have enabled 2nd level cache, using EHCache. Now i save an object O by saying session.save(O). The object O is stored in session. Will it also be stored in second level cache.