Hibernate has two caches. The "First Level Cache" is the Session cache and is implicit. Every object loaded into the same Session is in this cache. The "Second Level Cache" is a mechanism Hibernate provides to allow object to be loaded into another caching technology (such as
JBoss Cache). You need to configure both the second level cache plus define in your mapping files which objects participate in this cache.
its generating some internal id
Hibernate, assuming your mapping files are correct, uses a records Primary Key to identify objects. It doesn't generate any other ID, internal or otherwise, to identify objects in the Session.
Now when in second application using hibernate again i try to insert some third value to same table i doesn't permit to insert this new value(As what we are thinking here internal hibernate cache is having some conflict with these two self generated ids.)
What is the Exception you see? When you say "self-generated" do you mean you are using the "assigned" primary key generation strategy and it is your own application that is providing the primary key value?
the other thing is that if i create my own cache mechanism (not by hiberanete) maintenane or say the speed will vary as every time updating
values will upload and next time will be able to read from cache.
Not sure I understand you here. Are you asking if using a cache will make the application run faster? If so, then the answer is usually yes, since you no longer have to go to the database for every object. However you increase the likelyhood of stale objects.