Kevin Pang

Ranch Hand
+ Follow
since Mar 01, 2005
Merit badge: grant badges
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 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(AbstractLazyInitializer.java:132)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
at com.yatsun.entity.Country_$$_javassist_4.getCustomers(Country_$$_javassist_4.java)
... 34 more


the entity:
@Entity
@Table(name = "COUNTRY")
public class Country extends ValueObjectImpl implements java.io.Serializable {

// 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")
@JoinTable(name="CUSTOMER",
joinColumns={@JoinColumn(name="COUNTRY")},
inverseJoinColumns={@JoinColumn(name="COUNTRY_ID")})
@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 .
thanks.
14 years ago
I found in toplink src class:
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider



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.
solved
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() ?
thanks.
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.

Thanks.
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?
thanks!
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) {

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

}catch(IOException e){
e.printStackTrace();
}

}
15 years ago
in windows environment.



java.io.IOException: Cannot run program ""D:\prog": CreateProcess error=193, %1 ???Ч?? Win32 ??ó
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:431)
at java.lang.Runtime.exec(Runtime.java:328)
at OpenExcel.main(OpenExcel.java:12)
Caused by: java.io.IOException: CreateProcess error=193, %1 ???Ч?? Win32 ??ó
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 4 more


appreciated.
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