- This topic has 8 replies, 3 voices, and was last updated 18 years, 4 months ago by Haris Peco.
-
AuthorPosts
-
subhakar_naniMemberpackage com.genuitec.hibernate;
import org.hibernate.*;
public class HibernateTest {
public static void main(String[] args) {
// Step 1 – Create a new entity
EchoMessage message = new EchoMessage();
// Step 2 – Set message field
message.setMsg(“Hello Hibernate, from MyEclipse!”);
try {
// Step 3 – Get a Hibernate Session
Session session = SessionManager.currentSession();
// Step 4 – Persist entity to database
Transaction tx = session.beginTransaction();
session.save(message);
tx.commit();
System.out.println(“Save successful.”);
} catch (Exception e) {
System.out.println(“Save failed.”);
} finally {
try {
// Step 5 – close the session
SessionManager.closeSession();
} catch (Exception e1) {
// do nothing
}
}
}
}It was giving an error message as Echo message cannot be resolved to type
Can any one please help me out of this.
Haris PecoMembersubhakar_nani ,
Please send su more details – my eclipse version, hibernate cfg.xml and hbm.xml ,POJO and
error log (Windows-Show View-Other-PDE Runtime-Error Log View)Best
qdong205Member@support-snpe wrote:
subhakar_nani ,
Please send su more details – my eclipse version, hibernate cfg.xml and hbm.xml ,POJO and
error log (Windows-Show View-Other-PDE Runtime-Error Log View)Best
I am having this same problem (“error message as Echo message cannot be resolved to type”) with this HibernateTest class. PLEASE HELP!
I am using:(1) MyEclipse JSF Support Version: 4.1.1 Build id: 20060309-4.1.1-GA
(2) hibernate cfg.xml
<?xml version=’1.0′ encoding=’UTF-8′?>
<!DOCTYPE hibernate-configuration PUBLIC
“-//Hibernate/Hibernate Configuration DTD 3.0//EN”
“http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”><!– Generated by MyEclipse Hibernate Tools. –>
<hibernate-configuration><session-factory>
<property name=”connection.username”>dp838</property>
<property name=”connection.url”>jdbc:oracle:thin:@localhost:1521:ORCL</property>
<property name=”dialect”>org.hibernate.dialect.Oracle9Dialect</property>
<property name=”myeclipse.connection.profile”>Oracle</property>
<property name=”connection.password”>dp838</property>
<property name=”connection.driver_class”>oracle.jdbc.driver.OracleDriver</property>
<property name=”max_fetch_depth”>1</property>
<mapping resource=”com/genuitec/hibernate/Trctableindex1.hbm.xml” /></session-factory>
</hibernate-configuration>
Haris PecoMembersubhakar_nani ,
Please, send us log from my previous post
Best
qdong205MemberSorry , this is not subhakar_nani. I am a new member, and I am qdong205. I have this same problem.
Here is the message from the err.log
!SESSION 2006-06-23 09:28:36.689 ———————————————–
eclipse.buildId=M20060118-1600
java.version=1.5.0_06
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:53.410
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\css_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:53.519
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\forms_lists_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:53.597
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\htmlform_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:53.659
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\html_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:53.722
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\javascript_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:53.816
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\jsf_f_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:53.909
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\jsf_h_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:54.143
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\struts_bean_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:54.268
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\struts_html_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:54.362
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\struts_logic_snippets.xml!ENTRY com.genuitec.eclipse.wizards 1 0 2006-06-23 09:28:54.440
!MESSAGE Installed snippet library: c:\APPS\program\MyEclipse\eclipse\plugins\com.genuitec.eclipse.wizards_4.1.1\snippets\struts_tiles_snippets.xml
qdong205MemberOne of my question related to this problem is that I seem not clear about how the table echo_message is used in the demo.
Haris PecoMembersorry for missing your name
I suppose that you haven’t added mapping (hbm.xml) for message table
Please set e.printStackTrace in catch clause (in example) and send output
Thanks
qdong205MemberThank you so much for suggesting hbm.xml for message table!! It solved my problem.
I am just starting to learn about Hibernate and MyEclipse..
However, I am wondering why there isn’t any explanation in the demo about mapping message table.Anyways, thank you for helping me.
Haris PecoMemberqdong205,
If you use hibernate wizard for mapping and check ‘Update configuration file with mapping file location (this is default) you will got mapping resource in *cfg.xml
Sorry for your inconvenience
Best regards
-
AuthorPosts