-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to create an easy working example with images,downloads
PostPosted: Thu Jun 07, 2007 4:55 pm 
Newbie

Joined: Tue Jun 05, 2007 4:03 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp


I have modified an example to make it even more easier for newbeis like me to get into Hibernate (for dummies :P )


First download the example
http://chulian1819.googlepages.com/sample1.war

Open "hibernate.cfg.xml" in "java resources" and configure your DB conection, and this project to your EAR,
create the table using "table.sql" for ORACLE, chek "serverConfig.JPG" to set properly your server configuration
and run on server the file "AddContact.jsp"

Image
this uses struts so if you want to add or change things you also have to modify "struts-config.xml" on WEB-INF folder

Code:
  CREATE TABLE "CONTACT"
   (   "ID" VARCHAR2(4000 BYTE) NOT NULL ENABLE,
   "FIRSTNAME" VARCHAR2(4000 BYTE),
   "LASTNAME" VARCHAR2(4000 BYTE),
   "EMAIL" VARCHAR2(4000 BYTE),
    CONSTRAINT "CONTACT_PK" PRIMARY KEY ("ID") ENABLE
   ) ;

Remember to put this libraries in ur lib folder
Code:
  antlr.jar
  cglib.jar
  asm.jar
  asm-attrs.jars
  commons-collections.jar
  commons-logging.jar
  hibernate3.jar
  jta.jar
  dom4j.jar
  log4j.jar


its made for WSAD 5.1 (websphere) on a ORACLE database




if you can make the example even more easier or has changes like conections to other DB or working on other IDE (JBoss, Eclipse, etc ), plz post it and share it

hope it works


Top
 Profile  
 
 Post subject: Using datasources in WSAD
PostPosted: Fri Jul 27, 2007 11:19 am 
Newbie

Joined: Tue Jun 05, 2007 4:03 pm
Posts: 2
Create your datasource, check this 2 pages (when u call the datasource normally):
http://www.webagesolutions.com/knowledg ... index.html
and other stuff when u have to call the datasourse "java:jdbc/TestDatasrc"
http://www.webagesolutions.com/knowledg ... index.html

afther this, check if its working by starting your server, afther that right click the server and lauch the "universal client tester"
Image
this will show u a web page, go chek your "jndi Explorer", for example if your datasource is "jdbc/TestDatasrc", in the "JNDI explorer" u must see a folder named "jdbc" and inside a file named "TestDatasrc", if u see that file in your "JNDI explorer" then your datasrc must be runing ok, or you can make a java object thats uses of the datasrc by the normal way to chek too if the datasrc is working ok. then u just have to set the porper atributes at the hibernate cfg file to tell it to use instead of a normal connection, a datasource.

Your cfg file should have this properties and maybe more:

Code:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!--http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd-->
<hibernate-configuration>
   <session-factory>
   
   
      <property name="connection.datasource">jdbc/TestDatasrc</property>
        <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
        <property name="jndi.class">com.ibm.websphere.naming.WsnInitialContextFactory</property>


<!--
      <property name="jndi.url">iiop://127.0.0.1:2809</property>       
      <property name="transaction.manager_lookup_class">   
         org.hibernate.transaction.WebSphereTransactionManagerLookup            
      </property>       
         <property name="transaction.factory_class">                      
          org.hibernate.transaction.JDBCTransactionFactory
      </property>
-->
      <mapping resource="TEST_MAPPING.hbm.xml"/>
   </session-factory>
</hibernate-configuration>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.