Vijay Kashyap

Ranch Hand
+ Follow
since Jul 30, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vijay Kashyap

Kevin,

Thanks for the reply. Well I am going with 2 DTO's for clarity sake, as mentioned by you.

Regards,
Vijay
Hi All,

I have a situation where a data transfer object(DTO) used between Service layer and web layer holds a number of java.util.List's. But the type of object in the list will change depending upon data transfer direction.

For example List will hold object of Type ClassA when Web layer is using the DTO populated by Service Layer but it will hold object of Type ClassB when Service layer is using the DTO populated by Web Layer.

I know that this won't work if I use Generics (1.5) but as I am not using 1.5 is this looks ok from architecture point? Or should I define 2 different DTO's for this.

Regards,
Vijay
Does anybody knows from where can I download Hibernate console tool that runs from command line instead of eclipse? I am using Eclipse 3.2 and tried Hibernate Console tool but it throws this error



I prefer the command line utility, I have used it before but forgot the location from where to get it.


Thanks,
Vijay
Stan,

Thanks for replying.

Vijay
I have a situation where a resource and time intensive operations needs to be handled asynchronusly using JMS so that user can work on other part of application without waiting for the process to finish. I am planning to give the user access to synchronus calls as well.

Currently my application looks more or less like 3 tier application where front end (struts) framework talks to service tier which in turn talks to business layer (DAO implementation).

Now my question:

Will it be fine from design point of view if I let Service layer invoke JMS message which would be processed by Message Processor and in turn calls again the service tier (albeit this time the synchronus call) to perform the resource intensive work. I want to avoid adding more layer to my existing application and see it as a viable option.

Please let me know if it defies any normal rules.

Thanks,
Vijay
Just for information,

I am able to resolve the issue. Its down to the fact that hibernate property hibernate.jdbc.batch_versioned_data is set to true, which causes Hibernate to skip versioning check and hence it is not reporting StaleObjectStateException error and record is not getting updated either.

Thanks
Mark thanks for taking initiative.

version is getting incremented when an update happens, even if I do the update manually by forcing the version update still the next update with old version should fail but thats not happening. Only when I set select-before-update="true" then the update fails.

I am not sure is something else needs to be specified to get the right behaviour.

Regards,
Vijay
Can some body explain if this is the expected behaviour,

My application uses 'version' for optimistic locking and following is used to specify the version property

@hibernate.version column="version_id" type="long"


I am reading a record for update (displayed on GUI). During this update process (before making final update call) some other process (may be external) comes along and updates the same record setting version to a differnet value( +1). I expect Hibernate to throw StaleDataException when the GUI submits the record for updation. But to my surprise the record is updated, which overwrites the last update.

I observsed that an extra select query is fired immediately before update and this select query fetches the latest version which was set by other process. Why Hibernate is making extra select call is something which I have no clue about.


Another observation, When I set Select-Before-Update="true" then only Hibernate complains.


Thanks,
Vijay
Thanks Yim for your reply,

I am familiar with AspectJ, its just I was searching for a simpler solution if there exist any.
13 years ago
Thanks all of you for taking stab at this.

My problem is some what tricky, I have to log details (including parameter passed) for every exceptions generated by the application. I was thinking of minimizing the changes in order to set this up, but it seems there is no easy way other then making wholesome changes in order to capture method parameters.
13 years ago
I have a situation where I need to capture method arguments and its values whenever an exception is generated. I checked the Exception and Throwable classes but they don't hold any information about the method parameters.

Is there any way to acheieve this?

TIA
13 years ago
Peer,

Thanks for the links.

I came across a post (donot remember which forum) that highlights a pretty nice solution for data traversing where by callee will handle all SQLExceptions and take appropriate actions. That interface looks similar to the one I have described.

I need some more feedback as to why and when one should use this approach.

Is it making any sense, Whatever I have written.
I came across an Abstract class DataReader which looks like.



There are few different implementation of this abstract class used in application.


Can anyone tells me it is any sort of Design pattern?

Regards,
Vijay
Thanks Pascal,

I am creating a DTO wrapper over Model to avoid importing Hibernate classes.
Pascal,

Thanks for taking interest.

I cannot close the session as this function(where the object is gettign modified) is called number of times with in same transaction. Also closing session means I have to make explicit close call on session which again makes my code dependant on Hibernate.

Thanks