in connectivity

in connectivity

View Answers

May 2, 2008 at 6:37 PM

Hi friend,

This is connectivity and hibernate configuration 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">;

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/register</property>;
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="contact.hbm.xml"/>
</session-factory>


</hibernate-configuration>


-------------------------------

package roseindia;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateExample {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

Session session = null;

try{
// This step will read hibernate.cfg.xml and prepare hibernate for use
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
org.hibernate.Transaction tr = session.beginTransaction();
//Create new instance of Contact and set values in it by reading them from form object
System.out.println("Inserting Record");
Contact contact = new Contact();
contact.setId(1);
contact.setFirstName("Vinod");
contact.setLastName("Kumar");
contact.setEmail("[email protected]");

session.save(contact);
tr.commit();
System.out.println("Done");
}catch(Exception e){
System.out.println(e.getMessage());
}
finally{
session.close();

}
}

}
-------------------------

May 2, 2008 at 6:39 PM

package roseindia;

public class Contact {

private String firstName;
private String lastName;
private String email;
private int id;

public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}

}

------------------------------------

read for more information.

http://www.roseindia.net/hibernate/









Related Tutorials/Questions & Answers:
database connectivity
database connectivity  describe java program steps in order to get connectivity to database along with example
database connectivity
database connectivity  how to create database connectivity between HTML and sql server2005
Advertisements
Java connectivity with MySQL
Java connectivity with MySQL  Java connectivity with MySQL
connectivity with php
connectivity with php  i have make one html form and doing connectivity with php database but when i click on submit button on html form display all coding in php form about connectivity instead of adding data, i used in html
java connectivity
java connectivity  hi........ Can u help me to do connectivity between java and weka??????? weka is a data mining tool which allows to do prediction, classification etc.... i want to do connectivity between weka and java can u
connectivity problem
connectivity problem  i am facing error in Class.for name statement... connectivity still i am facing this error* ================================oracle connectivity program============================ import java.sql.*; import
DB connectivity - EJB
DB connectivity  DB connectivity
connectivity with access
connectivity with access  how to connect with data base with access sheet. in my application form there is two JTextArea and Two JComboBox.   Is this Access database or excel sheet. Do you want to display the values
JDBC CONNECTIVITY
file in environment variable.   Java Mysql connectivity Other JDBC
connectivity with mysql
connectivity with mysql  if this code of roseindia doesnt work,then what to do..cant connect with my sql http://www.roseindia.net/tutorial/php/phpdatabase/Check-PHP-MySQL-Connectivity.html   Please visit the following
connectivity
connectivity
connectivity
in connectivity - Hibernate
insertted  Hi friend, This is connectivity and hibernate configuration
JDBC CONNECTIVITY
connectivity Other JDBC Tutorials
connectivity step
connectivity step  sir.pls give me step one by one for connect the java program to oracle.   Follow these steps: 1) Import the following packages in your java file:*** import java.sql.*; import oracle.jdbc.driver.
ModuleNotFoundError: No module named 'connectivity'
ModuleNotFoundError: No module named 'connectivity'  Hi, My Python... 'connectivity' How to remove the ModuleNotFoundError: No module named 'connectivity' error? Thanks   Hi, In your python
sql connectivity through java
sql connectivity through java  i want an example for java db through sql connection. Thanks in advance
Validate telnet connectivity
Validate telnet connectivity  How to validate telnet connectivity in my java code
J2ME connectivity to ms access
J2ME connectivity to ms access  How to establish client server connectivity to access ms access database on the server side? I have made the odbc connection. Plz help me in the coding part.. Dont know how to start
jdbc connectivity to mysql tutorial
jdbc connectivity to mysql tutorial  here is complete jdbc connectivity to mysql tutorial for newbies. Person who don't even know how to install mysql and don't know about which driver to use can do with ease
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
Database connectivity Hibernate mysql connection.
Database connectivity Hibernate mysql connection.  How to do database connectivity in Hibernate using mysql
Eclipse Connectivity - JDBC
Eclipse Connectivity  Hello Friends.. I want to do connectivity... connectivity..and which plugins are required for it. i have try to do connectivity but i got given below error. "Error Occured Error
oracle connectivity problem with netbeans
oracle connectivity problem with netbeans  sir I am using oracle.... for this after adding new driver(ojdbc6.jar) in services tab I got connectivity with oracle... of simple connectivity with oracle in this I am giving driver details
j2me mysql connectivity
j2me mysql connectivity  I do a project on reservation using j2me. I need a connectivity to a MYSQL database. How do I do this Thanks and regards Karthiga
database connectivity problem
database connectivity problem  what if client dont have database with them then what is other way to run successfully our programm   Please visit the following link: http://www.roseindia.net/jdbc
Database Connectivity Withe Oracle
Database Connectivity Withe Oracle  Develop a program to perform the database driven operation like insert, Delete, Update and select. To perform the above operations create one table named Employee. Field Name Field Type EmpId
jdbc oracle connectivity problem
jdbc oracle connectivity problem  Hi All, I am trying to connect my swing application to oracle DB . but class.forname is giving error. Please suggest me if there is some different way to connect swing application to oracle
ModuleNotFoundError: No module named 'spectral-connectivity'
ModuleNotFoundError: No module named 'spectral-connectivity'  Hi...: No module named 'spectral-connectivity' How to remove the ModuleNotFoundError: No module named 'spectral-connectivity' error? Thanks   Hi
Access 2007 database connectivity
source and destination. pls tell me the code of connectivity with access 2007
Oracle Database connectivity probem
Oracle Database connectivity probem  hi Below is the code of oracle database connectivity, when i compile it, it will show the error: oracle.jdbc.driver.OracleDriver I am using netbeans 6.5 and tomcat 6.0 and jdk 1.6 i have
database connectivity - JDBC
database connectivity  can u ppl pls provide me with database connectivity programs with MSacces   Hi Friend, If you havn't create your DSN,then follow these steps: 1. Open Data Sources (Start->Control Panel
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou.  Hi Friend, Put mysql-connector
Java to SQL Server Connectivity
with sql server connectivity at the background to save the data. Now, after... the connectivity wrong. Kindly help me resolve this issue ASAP. Thank you
database connectivity using mysql
database connectivity using mysql  java file: eg1.java package eg; import java.sql.*; public class eg1 { public static void main(String arg[]) throws SQLException { try { String connectionURL = "jdbc:mysql
servelet connectivity with oracle using procedure
servelet connectivity with oracle using procedure   kindly elaborate how servlet code connect to oracle br using procedure
jdbc connectivity through jsp
jdbc connectivity through jsp  my code: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http
database connectivity in java - JDBC
database connectivity in java  import java.io.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql.*; class Project implements ActionListener { JFrame f; JPanel p1,p2,p3; JTabbedPane
code to establish jdbc database connectivity in jsp
code to establish jdbc database connectivity in jsp  Dear sir, i'm in need of code and procedure to establish jdbc connectivity in jsp
code to establish jdbc database connectivity in jsp
code to establish jdbc database connectivity in jsp  Dear sir, i'm in need of code and procedure to establish jdbc connectivity in jsp
Version of com.applitools>eyes-connectivity-java-jersey1_17-sf2_51_0 dependency
List of Version of com.applitools>eyes-connectivity-java-jersey1_17-sf2_51_0 dependency
Version of com.applitools>eyes-connectivity-java-jersey1_17-sf2_53_1 dependency
List of Version of com.applitools>eyes-connectivity-java-jersey1_17-sf2_53_1 dependency
Version of com.applitools>eyes-connectivity-java-jersey1x dependency
List of Version of com.applitools>eyes-connectivity-java-jersey1x dependency
Version of com.applitools>eyes-connectivity-java-jersey2x dependency
List of Version of com.applitools>eyes-connectivity-java-jersey2x dependency
ModuleNotFoundError: No module named 'network-connectivity-tester'
ModuleNotFoundError: No module named 'network-connectivity-tester'  ...: No module named 'network-connectivity-tester' How to remove the ModuleNotFoundError: No module named 'network-connectivity-tester' error? Thanks
ModuleNotFoundError: No module named 'cloudshell-shell-connectivity-flow'
ModuleNotFoundError: No module named 'cloudshell-shell-connectivity-flow' ...: ModuleNotFoundError: No module named 'cloudshell-shell-connectivity-flow' How to remove the ModuleNotFoundError: No module named 'cloudshell-shell-connectivity-flow
jsp page connectivity with oracle - SQL
jsp page connectivity with oracle  I am unable to database connectivity jsp with oracle. Please send the code for solving problem. thanks  Hi Friend, 1)Import the packages: 2)Load the oracle driver
regarding connectivity program only - JDBC
regarding connectivity program only  can u give me code regarding .. that i had created student data base with his name and subject marks resp ... i..., i am sending simple code of connectivity import java.sql.*; public

Ads