i am creating a java object and saving it to the mysql database in which the table name is "student"

Description

package com.hibernate.demo;

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

import com.hibernate.entity.Student;

public class CreateStudentDemo {

public static void main(String[] args) {

//create session factory
SessionFactory factory = new Configuration()
.configure("hibernate.cfg.xml")
.addAnnotatedClass(Student.class)
.buildSessionFactory();

//create session
Session session = factory.getCurrentSession();

try {
//use the session object to save java object
System.out.println("Create a new student object...");
Student tempStudent = new Student("Paul", "Wall", "paul@luv2code.com");

//start a transaction
session.beginTransaction();

//save the student object
System.out.println("Saving the student");
session.save(tempStudent);

//commit transaction
session.getTransaction().commit();

System.out.println("Done!");

}
finally {
factory.close();
}

}

}

error:
Exception in thread "main" org.hibernate.internal.util.config.ConfigurationException: Unable to perform unmarshalling at line number 27 and column 20 in RESOURCE hibernate.cfg.xml. Message: cvc-complex-type.2.3: Element 'session-factory' cannot have character [children], because the type's content type is element-only.

Caused by: javax.xml.bind.UnmarshalException

Environment

Hibernate version 5.3.6
JDK 10
windows
mysql

Assignee

LINDOKUHLE MPANGELE

Reporter

LINDOKUHLE MPANGELE

Labels

Feedback Requested

2018/09/28

Feedback Requested By

None

backPortable

None

Suitable for new contributors

Yes, likely

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Priority

Critical
Configure