Kevin Pang

Ranch Hand
+ Follow
since Mar 01, 2005
Merit badge: grant badges
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 Kevin Pang

Cameron Wallace McKenzie wrote:

there is any method to solve this without changing the FetchType to EAGER ?

Well, that's sorta what you want, isn't it?

You can call the getter method earlier, within an open session.

You could also extend the Session. Look at the Hibernate "Open Session in View" pattern. That solves many of these types of problems.

-Cameron McKenzie

thanks for reply.

it seems that Open Session in View only works in web application ,isn't it?
Caused by: org.hibernate.LazyInitializationException: could not initialize proxy - no Session
at org.hibernate.proxy.AbstractLazyInitializer.initialize(
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(
at com.yatsun.entity.Country_$$_javassist_4.getCustomers(Country_$$
... 34 more

the entity:
@Table(name = "COUNTRY")
public class Country extends ValueObjectImpl implements {

// Fields

private Long countryId;
private String countryName;
private String code;
private List<Customer> customers=new ArrayList<Customer> ();

@OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.REFRESH, mappedBy="country")
@OrderBy(value = "customerId ASC")
public List<Customer> getCustomers() {
return customers;

public void setCustomers(List<Customer> customers) {
this.customers = customers;

if there is any method to solve this without changing the FetchType to EAGER ?
how to make jlable text selectable and copyable ?
i want to make the text be copied .
14 years ago
I found in toplink src class:

any solution to modify the persistence configuration file path without change toplink source ?
i want to load the persistence.xml by my java source code, not by toplink jpa, so i can load the persistence.xml from outside the jar file directory META-INF.
can i load the persistence.xml in my java code? and the persistence.xml is not in the "META-INF" folder.
how to achieve this?

thanks in adv.
Container c = jck.getParent();
Component[] comps = c.getComponents();
for (Component comp : comps) {
if (comp instanceof JCheckBox) {
if (((JCheckBox) comp).isSelected()) {
rsltInfor.append(((JCheckBox) comp).getText() + " ");

14 years ago
how to achieve the "check all" function and get the value from all jcheckbox checked ? how to do the function in swing as in javascript getElementById() ?
14 years ago
how to bind a int value to a jcheckbox? when user check the box, we can get the value of that checkbox.

14 years ago
code example:

if the database connecting work fails, for example database server is closed , how to stop the jdbc connection job?
thanks in advance.
14 years ago
will all the key information stored in swing application? or just the validation program logic is ok? how to generate as many as possible key without storing the key in client application?
14 years ago
i create a empty report in ireport 3.5.1. but I found that I can't drop the static text element from the Report Elements panel to the report designer.
what's the problem?
thanks in advance.
thanks for replies.

this is ok:

public static void main(String[] args) {

// Runtime.getRuntime().exec("\"D:\\prog file\\090422.xls\"");
String[] cmdarray=new String[]{"cmd.exe","/c","D:\\prog file\\090422.xls"};
// or Runtime.getRuntime().exec("cmd /c start \"\" \"D:\\prog file\\090422.xls\"");

}catch(IOException e){

15 years ago
in windows environment. Cannot run program ""D:\prog": CreateProcess error=193, %1 ???Ч?? Win32 ??ó
at java.lang.ProcessBuilder.start(
at java.lang.Runtime.exec(
at java.lang.Runtime.exec(
at java.lang.Runtime.exec(
at OpenExcel.main(
Caused by: CreateProcess error=193, %1 ???Ч?? Win32 ??ó
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(
at java.lang.ProcessImpl.start(
at java.lang.ProcessBuilder.start(
... 4 more

15 years ago
How to set component position in GridBagLayout JPanel ? I want to set the components on top left of the panel. now I can only make them on verticle center position of the JPanel.
Thanks in advance.
15 years ago