- This topic has 8 replies, 3 voices, and was last updated 19 years 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.
March 3, 2006 at 4:04 am #247665
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
June 23, 2006 at 9:29 am #253848
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>
June 23, 2006 at 9:44 am #253849
Haris PecoMembersubhakar_nani ,
Please, send us log from my previous post
Best
June 23, 2006 at 10:03 am #253851
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.xmlJune 23, 2006 at 10:23 am #253852
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.
June 23, 2006 at 10:51 am #253854
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
June 23, 2006 at 12:21 pm #253857
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.
June 23, 2006 at 1:01 pm #253859
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