File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package ru .javacourse ;
22
3+ import ru .javacourse .Dao .CommonDao ;
4+ import ru .javacourse .model .Resource ;
5+
36public class App {
47 public static void main (String [] args ) {
8+
9+ CommonDao dao = new CommonDao ();
10+ Resource resource = new Resource ();
11+ resource .setTechnology ("Java" );
12+ resource .setTag ("Spring" );
13+ resource .setTitle ("Для чего используется аннотация @Bean?" );
14+ resource .setDescription ("В классах конфигурации Spring, " +
15+ "@Bean используется для определения компонентов с кастомной логикой" );
16+ resource .setResourceType ("interview_question" );
17+ dao .save (resource );
18+
519 System .out .println ("Hello Source Code Student!" );
620 }
721}
Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ public static SessionFactory getSessionFactory(){
2020 ServiceRegistry serviceRegistry
2121 = new StandardServiceRegistryBuilder ()
2222 .applySettings (configuration .getProperties ()).build ();
23- configuration .addAnnotatedClass (Lesson .class );
24- configuration .addAnnotatedClass (LessonTask .class );
23+ // configuration.addAnnotatedClass(Lesson.class);
24+ // configuration.addAnnotatedClass(LessonTask.class);
2525 configuration .addAnnotatedClass (Resource .class );
26- configuration .addAnnotatedClass (Exercise .class );
26+ // configuration.addAnnotatedClass(Exercise.class);
2727 sessionFactory = configuration .buildSessionFactory (serviceRegistry );
2828 return sessionFactory ;
2929 }
Original file line number Diff line number Diff line change 11package ru .javacourse .model ;
2- import javax .persistence .Column ;
3- import javax .persistence .Entity ;
4- import javax .persistence .Id ;
5- import javax .persistence .Table ;
2+ import javax .persistence .*;
63import java .util .Arrays ;
74
85@ Entity
@@ -11,6 +8,7 @@ public class Resource
118{
129 @ Id
1310 @ Column (name = "resource_id" )
11+ @ GeneratedValue (strategy = GenerationType .IDENTITY )
1412 private Integer resourceId ;
1513
1614 @ Column (name = "technology" )
@@ -22,14 +20,12 @@ public class Resource
2220 @ Column (name = "title" )
2321 private String title ;
2422
25-
2623 @ Column (name = "description" )
2724 private String description ;
2825
2926 @ Column (name = "link" )
3027 private String link ;
3128
32-
3329 @ Column (name = "file" )
3430 private byte [] file ;
3531
Original file line number Diff line number Diff line change 1- hibernate.connection.driver_class = org.postgresql.Driver
2- hibernate.connection.url = jdbc:postgresql://193.124.16.45:5432/sourcecode
3- hibernate.connection.username = sc_user_role
4- hibernate.connection.password = source-code-2020
5- hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
1+ hibernate.connection.driver_class =org.postgresql.Driver
2+ hibernate.connection.url =jdbc:postgresql://151.248.118.12:5432/sourcecode
3+ hibernate.connection.username =sc_user
4+ hibernate.connection.password =123
5+ hibernate.dialect =org.hibernate.dialect.PostgreSQLDialect
6+ hibernate.ddl-auto =update
You can’t perform that action at this time.
0 commit comments