You are trying to mix two things
Annotations
and
LocalSessionFactoryBean
use the child class of LocalSessionFactoryBean that is
AnnotationSessionFactoryBean
replace this
LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean();
with
AnnotationSessionFactoryBean lsfb = new AnnotationSessionFactoryBean();
Class [] annotatedClasses = {Student.class};
lsfb.setAnnotatedClasses(annotatedClasses);
or
AnnotationSessionFactoryBean lsfb = new AnnotationSessionFactoryBean();
annotationSessionFactoryBean.setPackagesToScan(new String[]{"com.sample"});
see this answer