Bob Lawson

Ranch Hand
+ Follow
since Jul 20, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Bob Lawson

Questions about Learn Java Now (emailed them, waiting to hear back and will post response):

- Do any of the Java tutorials include developing in Eclipse?
- if I decide to keep the main $99 product, but do not want any or some of the additional tools, can I selectively get a refund for the tools I don't want?
- if I want to add additional tools in the future, how would I do that. Are the prices higher?
12 years ago
Good to know what my options are. Thanks for the info!
I was able to solve this problem by setting the hibernate cascade type to SaveOrUpdate, and then setting the cascade delete option in the database. It screams now.
I have an aggregation of objects, where one object contains many of another, each of which contain many of another, etc, etc. Here is my annotation for all one-to-many relationships:


@OneToOne(mappedBy="iterationCounty", fetch = FetchType.LAZY, cascade = { CascadeType.ALL })


The problem is that there are thousands of records to delete from various related tables, and it is taking forever. It seems that hibernate is actually loading in all the objects and then deleting them.

How can I improve performance?
I have a very large aggregation of domain entities, where one top object contains one-to-many of others, which themselves contain one-to-may of others, etc, etc. To annotate each relationship, I am using:

@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL })

However, when I try to delete the top object, I get a DataIntegrityViolationException because apparently the objects underneath would become orphans if the top were deleted. I also tried:


@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)

But got the same problem. This should be easy in Hibernate, so I'm sure there is something simple I am missing. Any help? Thanks.
I have some domain entities that are mapped via hibernate. These entities contain way too much data to send over the wire, so I want to convert them to lightweight DTOs, which I will then send over. Some of the DTOs will contain other DTOs, which also correspond to a domain entity that is mapped via hibernate.

Therefore, what is the best way to convert an aggregate of domain entities into lightweight corresponding DTOs?
Thanks for the info - I did not know about that. Sounds like just what I'm looking for. I will certainly give it a try!

Eric Pascarello wrote:Is the page posting back?

Make sure to cancel the button click.

Eric


I'm not sure what you mean. Could you elaborate?

Eric Pascarello wrote:What variables? What do you expect to get updated, you do not see variables, you see text that you add to form elements and other DOM elements.

Eric



Variables: pageDescription, executorState and applytBtn. These variables/form elements display properly initially, but when the user clicks applyBtn, a server-side call is made to start/stop the widget executor. Upon return from that (lines 63-78), the button text should be changed to 'Stop Executor' / 'Start Executor' (its a toggle). Also, the executorState should change to convey the current state of the widget executor ('The executor is currently running' or 'The executor is not currently running'). In Firebug, it shows that the changes were made to pageDescription, executorState and applytBtn. However, the html does not contain the changes.
Please forgive me, because I am a newcomer to JavaScript. But I am having the following problem: I created a form that displays some variables, and I am changing the values of those variables based on the results of AJAX calls. For some reason, after the listener executes, even though the variable values look correct in FireBug, they are not changed on the browser. Here is the javascript. Please help if possible:


Well, I thought it was exactly what I wanted. But now it turns out that it must run as a new thread, rather than run under the current thread as above. How would you do that?

Robin Sharma wrote:I mean it's so hard to follow the logic around because you keep jumping between sub-classes and super classes.



If you are jumping between super and sub, you may not be implementing the pattern correctly. It should always be one-directional (Don't call us, we'll call you principle), where the super contains the general algorithm and calls through abstract method for variations to that algorithm. Its the same way for the strategy pattern, just compositional instead of inheritance. Both these patterns allow implementation of Inversion of Control. So perhaps the issue is that you've seen abuses of the template method pattern.