Java/JDBC – SQL Server – “Integrated Security”

Background

Wanted to go over the steps to take when one needs to connect to a Microsoft SQL Server Instance using Integrated Security.

Outline

  1. Java
    • JDBC
      • JDBC Connecting String
    • Class Path
      • Includes SQL Server JDBC Driver
  2.  System
    • System Path
      • Add [jdbc-sql]\enu\auth\[platform]\

Tasks

Java

JDBC

JDBC Connecting String

Outline
  1. JDBC URL
    • IntegratedSecurity=True
    • authenticationScheme=NativeAuthentication
Syntax

jdbc:sqlserver://{server-name}:{port};IntegratedSecurity=True;authenticationScheme=NativeAuthentication;databaseName={database};

Sample

jdbc:sqlserver://localhost:1433;IntegratedSecurity=True;authenticationScheme=NativeAuthentication;databaseName=sakila;

java Class Path

SQL Server JDBC Driver

Please include your jdbc driver as part of your classpath when you launch your app.

In our case, %_sqlServerJDBCPath%\ sqljdbc_7.0\enu\mssql-jdbc-7.0.0.jre8.jar

 

System Path

Enhance your system path to include the sqljdbc_[version]\enu\auth\x64\ folder.

We are on SQL JDBC Version 7 and our platform is 64-bit.

Our relative path is sqljdbc_7.0\enu\auth\x64.

Code

Sample


set "_libSQLServerAuth_Folder=C:\downloads\Microsoft\SQLServer\jdbc\v7.0.0.0\extract\sqljdbc_7.0\enu\auth\x64\"

set path=%path%;%_libSQLServerAuth_Folder%

Trouble Shooting

Here are a couple of areas that you may stumble upon.

WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path

Error

Error Image

Error Text


WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path: [C:\Program Files\Java\jdk-11.0.3\bin,
[WARN ] 2019-06-10 12:57:02.390 [main] JdbcEnvironmentInitiator - HHH000342: Could not obtain connection to query metadata : null
[INFO ] 2019-06-10 12:57:02.424 [main] Dialect - HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
[WARN ] 2019-06-10 12:57:02.502 [main] SqlExceptionHelper - SQL Error: 0, SQLState: 08S01
[ERROR] 2019-06-10 12:57:02.509 [main] SqlExceptionHelper - This driver is not configured for integrated authentication.
Exception :- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

Error Explanation

  1. WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path

Resolution

  1. java.library.path
    • WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
  2. Please include the folder where sqljdbc_auth is located in your system path.

 

Screen Shots

Hibernate

Working

Image -01

References

  1. Microsoft
    • Docs
      • Docs / SQL / Connect / JDBC / Programming Guide for JDBC SQL Driver / Guide articles
        • Building the Connection URL
          Link
    • CSS SQL Server Engineers
      • Adam W. Saxton
        • JDBC: This driver is not configured for integrated authentication
          Link

 

Hibernate / DB Metadata

Background

In the early stages of learning Hibernate, I wanted to get some metadata about my database.

But, was lost as to how to do so.

Outline

  1. Connect to Database
  2. Get Session
    • Cast Session to sessionImpl
    • Get Connection from sessionImpl
    • Get metadata from Connection
      • Access metadata
        • getURL
        • getDriverName
        • getDatabaseProductName
        • getDatabaseProductVersion
        • getUserName
        • getDefaultTransactionIsolation

Code

void getDBMetadata(Session session)
    throws Exception
    {

        SessionImpl sessionImpl;
        Connection conn;
        DatabaseMetaData dbMetadata;

        int iDefaultTransactionIsolation;
        String strDefaultTransactionIsolation = null;

        //get Session Implementation
        sessionImpl = (SessionImpl) session;

        //Get Session Implementation Connection
        conn = sessionImpl.connection();

        //Get Metadata
        dbMetadata = conn.getMetaData();

        System.out.println
        (
              "Database URL :- "
            + dbMetadata.getURL()
        );

        System.out.println
            (
                  "Driver Name :- "
                + dbMetadata.getDriverName()
            );

        System.out.println
        ("Database Product Name :- "
            + dbMetadata.getDatabaseProductName()
        );

        System.out.println
            (
                "Database Product Version :- "
                        + dbMetadata.getDatabaseProductVersion()
            );

        System.out.println
        (
            "Database Username:- "
                + dbMetadata.getUserName()
        );          

        iDefaultTransactionIsolation
        	= dbMetadata.getDefaultTransactionIsolation();

        strDefaultTransactionIsolation
        	= getDefaultTransactionIsolationAsString
        	  (
    			  iDefaultTransactionIsolation
			  );

        System.out.println
        (
            "Default Isolation Level ( as int ):- "
                    + dbMetadata.getDefaultTransactionIsolation()
        );  

        if (strDefaultTransactionIsolation != null)
        {

	        System.out.println
	        (
	            "Default Isolation Level ( as String ) :- "
	                    + strDefaultTransactionIsolation
	        );
        }

    }

 

    String getDefaultTransactionIsolationAsString(int value)
    {

    	String strValue = null;

    	switch(value)
    	{
    	   case java.sql.Connection.TRANSACTION_NONE:
    		  strValue = "None";
    	      break; 

    	   case java.sql.Connection.TRANSACTION_READ_COMMITTED :
    		  strValue = "Read Committed";
    	      break; 

    	   case java.sql.Connection.TRANSACTION_READ_UNCOMMITTED :
     		  strValue = "Read UnCommitted";
     	      break; 

    	   case java.sql.Connection.TRANSACTION_REPEATABLE_READ :
      		  strValue = "Repeatable Read";
      	      break; 

    	   case java.sql.Connection.TRANSACTION_SERIALIZABLE :
       		  strValue = "Serializable";
       	      break; 

    	   default :
    	      strValue = null;
    	}

    	return (strValue);

    }

Output

Output – Text


Database URL :- jdbc:sqlserver://localhost:1433;useBulkCopyForBatchInsert=false;cancelQueryTimeout=-1;sslProtocol=TLS;jaasConfigurationName=SQLJDBCDriver;statementPoolingCacheSize=0;serverPreparedStatementDiscardThreshold=10;enablePrepareOnFirstPreparedStatementCall=false;fips=false;socketTimeout=0;authentication=NotSpecified;authenticationScheme=nativeAuthentication;xopenStates=false;sendTimeAsDatetime=true;trustStoreType=JKS;trustServerCertificate=false;TransparentNetworkIPResolution=true;serverNameAsACE=false;sendStringParametersAsUnicode=true;selectMethod=direct;responseBuffering=adaptive;queryTimeout=-1;packetSize=8000;multiSubnetFailover=false;loginTimeout=15;lockTimeout=-1;lastUpdateCount=true;encrypt=false;disableStatementPooling=true;databaseName=sakila;columnEncryptionSetting=Disabled;applicationName=Microsoft JDBC Driver for SQL Server;applicationIntent=readwrite;
Driver Name :- Microsoft JDBC Driver 7.0 for SQL Server
Database Product Name :- Microsoft SQL Server
Database Product Version :- 14.00.3045
Database Username:- sakila
Default Isolation Level ( as int ):- 2
Default Isolation Level ( as String ) :- Read Committed

Output – Image

 

Source Code Control

GitHub

DanielAdeniji/HibernateDBMetadata
Link

 

References

  1. Oracle.com
    • java.sql
      • DatabaseMetaData
      • Connection
    • API
      • Constant Field Values
    • Sun Java System Application Server Platform Edition 8.2 Developer’s Guide
      • Using JDBC Transaction Isolation Levels
  2. jboss.org
    • org.hibernate
      • org.hibernate.impl

 

java – Log4j

Background

Playing around with Hibernate got me staring at the screen reviewing console messages; especially SQL statements.

Log4j

Time to implement better logging; mostly instead of having it show up on the console, placing it in log files.

Download

Artifacts

log4j is available here ( https://logging.apache.org/log4j/2.x/download.html ).

Version

The current version is 2.11.2

Download

Please download and extract the files.

I am on Windows and chose apache-log4j-2.11.2-bin.zip.

Project Configuration

Eclipse

This is a simple test and so started a new project.

Project Configuration

In Eclipse, please access the Java Build Path.

Files

  1. log4j-api-2.11.2.jar
  2. log4j-core-2.11.2.jar

Image

Configuration Files

Log4j

Sample

log4j2.property.20190518.0147PM

Java

Outline

  1. Import packages/classes
    • Apache – log4j
      • org.apache.logging.log4j
        • import org.apache.logging.log4j.LogManager;
        • import org.apache.logging.log4j.Logger;
    • Network
      • java.net
        • Import java.net.InetAddress
        • Import java.net.UnknownHostException
  2. Instantiate Logger
    • LogManager.getLogger
  3. Use Logger
    • Invoke Log
      • log.info
      • log.error

Sample


package log4j2;

import java.util.Map;

import java.net.InetAddress;
import java.net.UnknownHostException;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public final class hello
{

	private static final Logger log
				= LogManager.getLogger
					(
							log4j2.hello.class
					);

	public static void main(String[] args)
	{

		// TODO Auto-generated method stub
		String computerName = null;

		computerName = getComputerName();

		if (computerName != null)
		{

			computerName = getHostName();

		};

		//computerName = null;

		if (computerName != null)
		{
			log.info("Computer :- " + computerName);
		}
		else
		{

			log.error("Unknown Computer!");

		}

	}

	static private String getHostName()
	{

		String hostname = null;

		try
		{
		    InetAddress addr;
		    addr = InetAddress.getLocalHost();
		    hostname = addr.getHostName();
		}
		catch (UnknownHostException ex)
		{
		    System.out.println("Hostname can not be resolved");
		}

		return (hostname);

	}

	/*
	 *
	 * https://stackoverflow.com/questions/7883542/getting-the-computer-name-in-java
	 */
	static private String getComputerName()
	{
	    Map env = System.getenv();
	    if (env.containsKey("COMPUTERNAME"))
	        return env.get("COMPUTERNAME");
	    else if (env.containsKey("HOSTNAME"))
	        return env.get("HOSTNAME");
	    else
	        return null;
	}

}

Output

Source Control

Git

log4j.2.sample
Link

Summary

A couple of quick points.

A lot of the Log4j sample configuration files available on the Internet are based on the original implementation.

The current version of Log4j is version 2, Log4j2.

Its XML Schema is quite different than Version 1.

Please look for samples that explicitly mention and reference, Log4j2.

 

Java – Set – Method – Remove – Null Exception

Background

Trying to familiarize myself with Collection classes in Java.

With Hibernate being an ORM tool that encapsulates database processes, one has to have a good grasp of records and set operations.

Error

I ran into a blocking error.

It simply read null.

 

Code

Original Code

Java Snippet


Set cities = new HashSet();

for (City city:cities)
{

	if (city != null)
	{

		removeCity(city);

		//Doing this raised Exception
		//Exception Message is null
		cities.remove(city);

	}		

}

Output

Exception


Exception Message is null
StackTrace

Revised Code

Java Snippet


Set cities = new HashSet();

Iterator iterator = cities.iterator();

while (iterator.hasNext())
{

	City city = iterator.next();

	removeCity(city);

	iterator.remove();

}

 

Summary of Change

In the erroring code :-

  1. We iterated the set using the for-each construct
    • Process each node
    • Attempt to remove the processed node via invoking the remove method
      • Hashset.remove
        • Failed
          • null exception

The revised code :-

  1. Instantiated an iterator against the collection
  2. Checked for next node via the hasNext method
  3. If hasNext is positive :-
    • Invoke next against the Iterator, receive back the node
    • Process the node
    • Invoke remove against the Iterator

References

  1. java tutorial
    • Interfaces
      • The Set Interface
        Link
  2. java references
    • java.util
      • java.util.HashSet
        • Class HashSet<E>
          Link
    • java.util
      • java.util.Iterator
        • Interface Iterator<E>
          Link

Hibernate/Annotation – Error – “Schema-validation: missing column”

Background

Adding more functionality to a POJO ( Plain Old Java Object) class that relies on Annotations.

Error

But, here ended up with an error!

Error Message


Schema-validation: missing column [bResetDependantEntityCountryIDOnDelete] in table [dbo.country]
Failed to create sessionFactory object.org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [bResetDependantEntityCountryIDOnDelete] in table [dbo.country]
Exception in thread "main" java.lang.ExceptionInInitializerError
        at sakila.helloDB.dbWork(helloDB.java:166)
        at sakila.helloDB.run(helloDB.java:55)
        at sakila.helloDB.main(helloDB.java:42)
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [bResetDependantEntityCountryIDOnDelete] in table [dbo.country]
        at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:136)
        at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:42)
        at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:89)
        at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:68)
        at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:192)
        at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:73)
        at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:309)
        at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
        at sakila.helloDB.getDBSession(helloDB.java:82)
        at sakila.helloDB.dbWork(helloDB.java:116)
        ... 2 more

Error Image

SchemaValidationMissingColumn.20190516.0828PM.PNG

Code

Outline

  1. “Decorate” variable declaration with the keyword @Transient

Code


    private Boolean bResetDependantEntityCountryIDOnDelete = true;

    public Boolean getResetDependantEntityCountryIDOnDeleteFlag()
    {
        return bResetDependantEntityCountryIDOnDelete;
    }

    public void setResetDependantEntityCountryIDOnDeleteFlag(Boolean value)
    {
    	bResetDependantEntityCountryIDOnDelete = value;
    }

Revision


    //object.org.hibernate.tool.schema.spi.SchemaManagementException:
    //Schema-validation: missing column
    @Transient
    private Boolean bResetDependantEntityCountryIDOnDelete = true;

    public Boolean getResetDependantEntityCountryIDOnDeleteFlag()
    {
        return bResetDependantEntityCountryIDOnDelete;
    }

    public void setResetDependantEntityCountryIDOnDeleteFlag(Boolean value)
    {
    	bResetDependantEntityCountryIDOnDelete = value;
    }

Hibernate – Error Message – “Unknown entity”

Background

Learning new tooling is not easy for me.

Error

Image

unknownEntity.20190509.0942AM

Textual

Unknown entity: sakila.Country

Trouble Shooting

Metadata

Entities Registered

Outline

  1. Start a Session or use an existing one
  2. Get Session’s Transaction handle
  3. Start a new transaction
  4. Get Session’s metamodel
  5. Get Metamodel entity list
  6. Iterate Metamodel entity list
  7. Commit Transaction

Code

/*
     * This function lists the entities declared in our session
     * It principally relies on session.getMetaModel.getEntities
     */
    private void entityList
    (
		  Session session
	)
    { 

    	String strEntity;
    	int i;
    	int iNumberofElements;
    	Transaction transaction;
    	Metamodel objEntityManager;
        Set objEntityTypeList;

    	try
        {

        	System.out.println("Retrieve entities ...."); 

        	//Get Session's Transaction
        	transaction
        		= session.getTransaction();

        	//Start Transaction
            transaction.begin();

            //Get MetaModel
            objEntityManager
            	= session.getMetamodel();

            //Get Entities
            objEntityTypeList
            	= objEntityManager.getEntities();

            //get Number of Entities
            iNumberofElements
            	= objEntityTypeList.size();

        	System.out.println
        		(
					CHAR_TAB
					+ "Number of elements is "
					+ iNumberofElements
				); 

        	//reset i
            i = 0;

            //Iterate through collection
            for (javax.persistence.metamodel.EntityType objEntityType:  objEntityTypeList)
            {

            	//increment
            	i = i +1;

            	//Get Entity
            	strEntity = objEntityType.toString();

            	//Display Entity
            	System.out.println
            	(
    				CHAR_TAB + CHAR_TAB
    				+ i
    				+ ") "
            	    + strEntity
        	    ); 

            }

        	System.out.println("Entities Retrieved"); 

        	//Close Transaction
            transaction.commit();

        }

    	catch (Exception ex)
    	{

    		System.out.println(ex.getMessage()); 

            if (session.getTransaction().isActive())
            {
                session.getTransaction().rollback();
            }

        } //Iterate through collection catch

	} //entityList<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>

Similar Errors

@OneToOne or @ManyToOne on [entity] references an unknown entity

Image

@OneToOne or @ManyToOne on sakila.City.country references an unknown entity.

Text


Failed to create sessionFactory object.org.hibernate.AnnotationException:
@OneToOne or @ManyToOne on sakila.City.country references an unknown entity: sakila.Country

@OneToOne or @ManyToOne on sakila.City.country references an unknown entity: sakila.Country

Summary

Was able to confirm that the entities were not registering correctly.

And, moved on from there and sought help from a real Java developer.

Hibernate – SQL Server – Exercise – 01

Background

Wanted to share source code for a sample helloDB Script that I am trying to use as I self teach Hibernate.

Outline

  1. Database File
    • DDL
      • Table
        • dbo.Country
  2. Java Source File
    • helloDB.java
  3. Hibernate Configuration File
    • SQLServerSavila.cfg.xml
  4. Entity
    • Country
      • Country.java ( POJO File )
      • Country.hbm.xml ( XML )

Source Code

Database

DDL

Table

Country
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

USE [sakila]
GO

/*
    drop table [dbo].[country];
*/

/*
    truncate table [dbo].[country];
*/

/*
    select *
    from [dbo].[country];
*/
IF NOT EXISTS
(
    SELECT *
    FROM sys.objects
    WHERE object_id = OBJECT_ID(N'[dbo].[country]')
    AND type in (N'U')
)
BEGIN

    CREATE TABLE [dbo].[country]
    (
        [country_id] [smallint] NOT NULL,
        [country] [varchar](50) NOT NULL,
        [last_update] [datetime] NULL

        , constraint [dbo.PK_Country]
          primary key
        (
            [country_id]
        )
    )
    ON [PRIMARY]

END
GO

Source Code

helloDB.java

package sakila;

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

import java.sql.Timestamp;
import java.util.Calendar;
import java.util.List;
import java.util.Set;

public class helloDB
{

	Configuration objConfiguration = null;

	static String CONFIGURATION_FILE_SQLSERVER = "SQLServerSakila.cfg.xml";

	SessionFactory factoryMSSQL = null;

	static String CHAR_TAB = "\t";

	public static void main(String[] args)
	{

		// TODO Auto-generated method stub
		run();

	}

	public static void run()
	{

			helloDB objHelloDB = null;

			objHelloDB = new helloDB();

			try
			{
				objHelloDB.dbWork();
			}
			catch (Exception ex)
			{

				System.out.println(ex.getMessage());

			}

			objHelloDB =null;

	}

    private Session getDBSession()
    {
    	Session session = null;

    	Configuration cfg= new Configuration();

    	cfg.configure(CONFIGURATION_FILE_SQLSERVER);

    	factoryMSSQL
			= cfg.buildSessionFactory();

    	session = factoryMSSQL.openSession(); 

    	//session = factoryMSSQL.getCurrentSession(); 

    	return session;

    }

    void dbWork()
	//throws Exception
    {

    	try
    	{

    		Session session = null;

    		session = getDBSession();

	    	entityList(session);

	    	countryAddList(session);

	    	countryList(session);

	    	session.close();

	    	factoryMSSQL.close();

    	}
		catch (Exception ex)
		{

			System.out.println(ex.getMessage());

			System.err.println("Failed to create sessionFactory object." + ex);

			throw new ExceptionInInitializerError(ex);
		}

    }

    // list all objects
    private void countryList(Session session)
    {

    	List lists;
    	Country       objCountry;

    	String strLog;

		System.out.println("List Countries");

		System.out.println("==============");

    	lists = session.createQuery("from Country").list(); 

    	System.out.println(lists.size()); 

    	for (int i = 0; i < lists.size(); i++)
    	{ 

			objCountry = lists.get(i);

			strLog = CHAR_TAB
						+ objCountry.getCountry()
						+ " "
						+ "("
						+ objCountry.getCountryID()
						+ ")";

			System.out.println(strLog);

    	}	

    }

    private void countryAddList
    (
		Session session
	)
	throws Exception
    {

    	countryAdd(session, 1, "United States of America");
    	countryAdd(session, 33, "France");
    	countryAdd(session, 44, "United Kingdom");
    	countryAdd(session, 55, "Brazil");
    	countryAdd(session, 61, "Australia");

    }

    private void countryAdd
    (
		  Session session
		, int countryID
		, String country
	)
	throws Exception
    {
        try
        {

        	Transaction transaction = session.getTransaction();

            transaction.begin();

            Country objCountry = new Country();

            objCountry.setCountryID(countryID);
            objCountry.setCountry(country);
            objCountry.settsUpdate(new Timestamp(Calendar.getInstance().getTime().getTime()));

            session.persist(objCountry);

            transaction.commit();

        }

    	catch (Exception ex)
    	{

			System.err.println("Failed to Add country " + country);

			System.out.println(ex.getMessage());

            if (session.getTransaction().isActive())
            {
                session.getTransaction().rollback();
            }

        }

	}

    private void entityList
    (
		  Session session
	)
	//throws Exception
    { 

    	String strEntity;
    	int iNumberofElements;
    	Set objEntityTypeList;

    	try
        {

            objEntityTypeList = session.getMetamodel().getEntities();

            iNumberofElements = objEntityTypeList.size();

        	System.out.println("Retrieve entities ...."); 

        	System.out.println(CHAR_TAB + "Number of elements is " + iNumberofElements); 

        	Transaction transaction = session.getTransaction();

            transaction.begin();

            for (javax.persistence.metamodel.EntityType objEntityType:  session.getMetamodel().getEntities())
            {

            	strEntity = objEntityType.toString();

            	System.out.println(CHAR_TAB + CHAR_TAB + "entity name "+strEntity); 

            }

        	System.out.println("Entities Retrieved"); 

            transaction.commit();

        }

    	catch (Exception ex)
    	{

    		System.out.println(ex.getMessage()); 

            if (session.getTransaction().isActive()) {
                session.getTransaction().rollback();
            }

            //throw ex;
        }

	}

}

Hibernate Configuration File

SQLServerSavila.cfg.xml





 

  org.hibernate.dialect.SQLServerDialect

  com.microsoft.sqlserver.jdbc.SQLServerDriver

  jdbc:sqlserver://localhost:1433;databaseName=sakila;

  sakila

  VecRadrI3h

  <!-- JDBC connection pool (use the built-in) -->
  
  	1
  

  thread

  <!-- Disable the second-level cache  -->
  
  	false
  

  <!-- Echo all executed SQL to stdout -->
  true

  <!-- Drop and re-create the database schema on startup -->
  <!-- validate schema on startup -->

  validate

  dbo

  

  &lt;!--
  	 
	--&gt;

 


Entity

Country

Country.java ( POJO File )

package sakila;

/*
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
*/

import java.sql.Timestamp;

public class Country
{

	private int CountryID;
	private String Country;
	private Timestamp tsUpdate;

	public Country()
	{

	}

	public Timestamp gettsUpdate()
	{
		return tsUpdate;
	}

	public void settsUpdate(Timestamp tsUpdate)
	{
		this.tsUpdate = tsUpdate;
	}

	public int getCountryID()
	{
		return CountryID;
	}

	public void setCountryID(int countryID)
	{
		CountryID = countryID;
	}

	public String getCountry()
	{
		return Country;
	}

	public void setCountry(String country)
	{
		Country = country;
	}

}

Country.hbm.xml ( HBM.XML File )





 

  

  

  

 


Source Code Control

GitHub

DanielAdeniji/javaHibernateSQLServerSakila
Link