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 Java JDBC JDBC Connecting String Class Path Includes SQL Server JDBC Driver ¬†System System Path Add [jdbc-sql]\enu\auth\[platform]\ Tasks Java JDBC JDBC Connecting String Outline JDBC URL IntegratedSecurity=True authenticationScheme=NativeAuthentication Syntax Sample java … Continue reading Java/JDBC – SQL Server – “Integrated Security”

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 Connect to Database Get Session Cast Session to sessionImpl Get Connection from sessionImpl Get metadata from Connection Access metadata getURL getDriverName getDatabaseProductName getDatabaseProductVersion getUserName getDefaultTransactionIsolation Code   Output … Continue reading Hibernate / DB Metadata

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 … Continue reading java – Log4j

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 Output Exception Revised Code Java Snippet … Continue reading Java – Set – Method – Remove – Null Exception

Hibernate – Error Message – “Unknown entity”

Background Learning new tooling is not easy for me. Error Image Textual Trouble Shooting Metadata Entities Registered Outline Start a Session or use an existing one Get Session's Transaction handle Start a new transaction Get Session's metamodel Get Metamodel entity list Iterate Metamodel entity list Commit Transaction Code Similar Errors @OneToOne or @ManyToOne on [entity] … Continue reading Hibernate – Error Message – “Unknown entity”

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 Database File DDL Table dbo.Country Java Source File helloDB.java Hibernate Configuration File SQLServerSavila.cfg.xml Entity Country Country.java ( POJO File ) Country.hbm.xml ( XML ) Source Code Database DDL Table Country Source Code … Continue reading Hibernate – SQL Server – Exercise – 01