Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!

Yan Hu

Greenhorn
+ Follow
since Sep 07, 2004
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 Yan Hu

Hi guys:
I would like to concatenate a few columns and then map it onto a single property in a java bean
For example
Select col_a || col_b as id from aTable

When it runs, it complains about �|| col_b � as a invalid column. Obviously IBaits did not try to concatenate these 2 columns.

Thanks for any input.
Ivan:
Here is how you get your bean out of the request scope

Application app = facesContext.getApplication();

// Say you have an instance of Footer.java stored in the request scope under the name "footer"

Footer footer =(Footer)app.createValueBinding("#{requestScope.footer}").getValue(facesContext)
13 years ago
JSF
Yes it is doable. You have 3 pages right? main.jsp, header.jsp. footer.jsp. For each of this page, you can have three backing beans, which are similar to the code behind files in asp.net. These 3 beans control the behavior of the three pages. And by default, the beans are stored in the request scope. Every time the main.jsp(including the footer and header) is accessed, an instance of each of these three beans is created and stored in the request scope, ready serving that request. When you want to change the behavior of the footer when a button on main.jsp is clicked, just get the bean corresponding to your footer.jsp,namely footer.java, from the request scope, and there you goooooo.
13 years ago
JSF
Hello Guys
I would like to have your input on this design. I am using Hibernate.
Business requirements:
I have a table called Action which contains a bunch of actions to be executed at different times. Each row represents an action entity that is modeled using Action.java. The action object can be modified and then updated. For each action updated, I want to keep a copy of the old action. That is I would like to keep a history of that action.

The first approach is too have a ActionHistory Table and a different Class , namely ActionHistory.java

In the Action Table, there are only the root Actions. It is a one-to- many relationship between these 2 tables

In the java semantic, it looks like

Class Action {
// Other simple property
Set<ActionHistory> history = new Hashset();


}


Class ActionHistory {
// Other simple property
Action rootAction;


}


If I need to go back to any historic copy for an Acton, I only update the contents of that root action with that particular historic object in my history set.


Now here is another approach using hibernate.

Using only one table, namely Action, and one class Action.java. All history is stored in the same table with a flag showing which one is the most current.


I have problems being convinced it is a better solution than the first approach.

My major gripes with this second approach are

1. What semantic does this table have? Is it an Action Table or is it an ActionHistory Table? The semantic of this table would be very confusing.

2. Losing all benefits of using Hibernate such tracing relationship between objects. In order to load a history of an Action, I would write a HQL with the second apporach. With the first approach, I would only need to load the root Action, not to mention other benefits like automatic cascading operations In other words, it is more sql oriented. When we resort to Hibernate, aren�t we trying to minimize sql statements where we can?

What do you people think? Your input is greatly appreciated.
Thank you guys. Now I am testing it using POI and Itext
14 years ago
Hi there:
I need to write some code to convert an Excel file to a PDF file. I googled it for 2 days. I could not find an open source java lib that can directly do that. I am thinking about using POI to read the Excel file and then use IText to write the contents out as a PDF. Does anyone have experience with this kind of conversion? Is there any better lib or solutions? Thanks in advance.
14 years ago
Hi Guys:
I am a huge the spring framework fan. I really buy into it. I never used EJBs before. I know EJBs are over engineered. But how do EJBs perform?
Hi Guys:
I am a huge fan of the spring framework. I really buy into it. I never used EJBs before. I know EJBs are over engineered. But how do EJBs perform? Are they slow?
I got it now. Thank you very much.
15 years ago
Thank you very much. I am working on a hibernate project. Inheritance and polymorphism mapping is very well supported in Hibernate. But I got confused a little bit. Now I got it straight..
15 years ago
However, a child object is also a parent object. A child has whatever the parent has. For example



Now, the child has a property "name"... Correct me if I am wrong.
15 years ago
Hi:
I have a question about private fields in a super class.

I tested the code. It seems that the child class inherits the private field of Mother. However, the field can be modified only through the setter. What I want to understand is whether a child subclass inherits everything from a parent class, including private data members.

So

aChild should have a private field �name�. Am I correct? Thanks.
15 years ago
Hello there:
I am a MS student in CS who is graduating very soon. I have always wanted to find a programming job with the server side. My school does not really teach anything relating to J2EE. All the stuff they teach here is low level system stuff which I think builds a solid CS foundation for me. However, it lacks when it comes to finding a J2EE job. .

I have no real job experience. But I am strong in OO and design patterns. Recently I have been learning J2EE myself. I don't really know if I am heading in the right direction to landing a J2EE job. I would like to hear some advices from you experienced Java people out there. I will be all ears.

The approach I take is:
Algorithms:
I believe it is the backbone of any programming languages. I practice it on Topcoder.
J2EE things:
Web components: JSPs and Java Servlets
Frameworks: currently learning struts. Interested in Spring
Persistent layers: Hibernate
Tools: Ant, JUnit
J2EE patterns

Please feel free to point out what I have done wrong. Any insight is greatly appreciated.
Thanks!