Vivek Kr Agrawal

Ranch Hand
+ Follow
since Sep 08, 2012
Vivek likes ...
Eclipse IDE Spring Java
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vivek Kr Agrawal

Hi All,
Even I am having the same problem. Ulf Dittmer, can you be more specific on how to use editor from these open sources?

8 years ago
Hi Jahangir Alam,
No doubt you made a very good point. The Java Spec says that everything in Java is pass-by-value. There is no such thing as "pass-by-reference" in Java.
But we need to understand that it doesn't exactly work in that way especially in case of objects. We can assume that java passes the reference of the object or objects as references passed by value.
For Example considering your code:

Lets see what others have to say about this.
8 years ago
On the matter of Static /private, if a variable is static it can not have instances or better say it will be same for all the instances of an Object.
For example,When you write

It will give you an output

As you can see the content of static variable will be same for both objects. Try to read about encapsulation as it will answer the need of creating
getters and setters; and creating declaring variables as private.
8 years ago
Thanks all for patiently replying.
I found this post also very helpful.
8 years ago
I know that the methods declared inside the Interfaces are abstract by default. But the question is why?
Let me simply it even further. Then why can't we have a body inside an abstract method. What I am missing here?
8 years ago
I guess this is what you want to use:
8 years ago
Hi all,
The unchecked exceptions especially null pointer exception are largely result of poor programming and methodology. So by doing coding in a better way it can be avoided. Having said that, checked exceptions like FileNotFound and IOException are forced by the compiler. They are meant to be catched and the user can recover from these failures.
8 years ago
Hi All,
Sorry to discuss this topic when there are literally thousands of links there. But sadly I found not of them giving me the exact solution.

My knowledge about unchecked Exception is "Any exception that can not be handled."
According to Oracle "Runtime exceptions are not subject to the Catch or Specify Requirement." And not to forget that Runtime Exceptions are just an unchecked Exception.

Consider the scenario
Now this

In the second scenario I have just successfully handled the unchecked exception. So why it is said that

Runtime exceptions are not subject to the Catch or Specify Requirement.

. Can someone please explain me what going on here?
8 years ago
Thanks for the reply,
I am doing a small POC on by using Envers. So far I have only one doubt. Consider that I have 5 tables that needs to be audited. I am putting to specify that this table needs auditing. But I was wondering is there any better method to specify that?
I mean, is there any way that we can give a user(in my case he will be administrator) the ability to decide which table he wants to audit. It does not make
much sense to me that he will be keep on changing the code himself if tomorrow he wants to add one more table for auditing?
Please consider that , it is an important requirement that all annotations should be moved into a xml metadata file(like orm.xml) to provide better configuration
Does Envers has anything up in its sleeves for it?
I am doing lots of R&D to do auditing for a big project. The project will be entirely beased on Spring framework with JPA and Hibernate to do the data mapping part. For auditing I have came across various features and technology.
Hibernate interceptors.
Hibernate Event listeners.
Hibernate Envers
Spring AOP.
I even tried creating and maintaining my own AUDIT table.

So far I am considering Hibernate Envers as my best bet as it reduces the manual coding and its versioning features is very interesting. Since it is a relatively new technology I don't have very much idea and I want to be pretty sure before implementing this as a part of solution.

So please suggest me which will technology will be best suited? Will Hibernate Envers be able to deal with complex business scenarios? Need some expert advice.
I am having a tough time implementing the auditing feature in Spring framework using JPA and Hibernate. Earlier the application was in simple JDBC and servlets and we are moving in with Spring and all that latest technology.
Here is the sample problem.
Consider there is a big table called Transactions which store the transaction of a particular Employee. I am having a bean for Transactiion like

And I have an Audit table to store the auditing details.The Audit table has one column IMAGE(BLOB type) in which I am storing the entire object of Transaction.
So the entire detail of a transaction(CRUD) is captured here.
The problem is that this TRANSACTION is a very big table(say having 50 columns) and the user wants to see 5 columns plus it should be also configurable.
Eg: One user can configure to see 5 columns today and 10 columns tomorrow. Earlier we were maintaining a separate table(AUD_CONFIG) to store the column names , a user want to see. Everything was fine till we were using the traditional JDBC but now the project needs to be upgraded to Spring with Hibernate using JPA. Now, I have the entire data in AUDIT table and an object of transaction which has 50 columns but the question is how to display it in a single screen?
somehow ,the user should be able to configure the fields he needs to see in the screen.
So please provide me any help to achieve this solution
8 years ago
I don't think Oracle or any of its version has anything to do with this problem. Please check the tomcat server once again. You can try deleting and creating the server instance in eclipse again.
Just search for the error message and you will find plenty of answers in various sites.
Just check this stackoverfow it may be useful.
Finally solved it. The bean needs to be instantiated
AppBean newBean=new AppBean();

now it will be inserted as new record. :-)
Sorry I am still not clear about it.
Let me paste my DAO class

Please let me know exactly what needs to be done.
thnks for the quick reply
i m using this annotation
@GeneratedValue(strategy= GenerationType.AUTO)
private int id;

the id is int so I can not make it as null and I already tried 0 but it didn't work. I searched in internet and I understood that if we try to modify a bean and then again save it, its gets updated in hibernate by default.
But in this case, i want to modify and then insert.