· 10 years ago · Aug 08, 2016, 09:27 AM
1<?xml version="1.0" encoding="UTF-8"?>
2<beans xmlns="http://www.springframework.org/schema/beans"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xmlns:context="http://www.springframework.org/schema/context"
5 xmlns:tx="http://www.springframework.org/schema/tx"
6 xsi:schemaLocation="http://www.springframework.org/schema/beans
7 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
8 http://www.springframework.org/schema/tx
9 http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
10 http://www.springframework.org/schema/context
11 http://www.springframework.org/schema/context/spring-context-3.0.xsd">
12 <context:component-scan base-package="fr.geom.core.controller"/>
13 <context:component-scan base-package="fr.geom.core.service"/>
14 <context:component-scan base-package="fr.geom.core.repository"/>
15 <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
16 <property name="dataSource">
17 <ref bean="dataSource" />
18 </property>
19 <property name="mappingResources">
20 <list>
21 <value>LineEntity.hbm.xml</value>
22 <value>PointEntity.hbm.xml</value>
23 <value>PolygoneEntity.hbm.xml</value>
24 <value>Coordinate.hbm.xml</value>
25 </list>
26 </property>
27 <property name="hibernateProperties">
28 <props>
29 <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
30 <prop key="current_session_context_class">thread</prop>
31 <prop key="show.provider_class">org.hibernate.cache.internal.NoCacheProvider</prop>
32 <prop key="show_sql">true</prop>
33 <prop key="format_sql">true</prop>
34 <prop key="hbm2ddl.auto">create</prop>
35 </props>
36 </property>
37 </bean>
38 <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
39 <property name="driverClassName" value="org.postgresql.Driver" />
40 <property name="url" value="jdbc:postgresql://localhost:5432/bdgeo" />
41 <property name="username" value="postgres" />
42 <property name="password" value="postgres" />
43 </bean>
44</beans>
45 package fr.geom.core.util;
46 import org.hibernate.SessionFactory;
47 import org.hibernate.cfg.Configuration;
48 public class HibernateUtil {
49 private static final SessionFactory sessionFactory = buildSessionFactory();
50
51 private static SessionFactory buildSessionFactory() {
52 try {
53 return new Configuration().configure().buildSessionFactory();
54 }
55 catch (Throwable ex) {
56 System.err.println("Initial SessionFactory creation failed." + ex);
57 throw new ExceptionInInitializerError(ex);
58 }
59 }
60 public static SessionFactory getSessionFactory() {
61 return sessionFactory;
62 }
63 }
64
65 package fr.geom.core.util;
66
67 import org.hibernate.SessionFactory;
68 import org.hibernate.cfg.Configuration;
69
70 public class HibernateUtil {
71
72 private static final SessionFactory sessionFactory = buildSessionFactory();
73
74 private static SessionFactory buildSessionFactory() {
75 try {
76 return new Configuration().configure().buildSessionFactory();
77 }
78 catch (Throwable ex) {
79 System.err.println("Initial SessionFactory creation failed." + ex);
80 throw new ExceptionInInitializerError(ex);
81 }
82 }
83
84 public static SessionFactory getSessionFactory() {
85 return sessionFactory;
86 }
87
88 }
89 package fr.geom.core.service;
90
91 import javax.annotation.Resource;
92 import org.springframework.stereotype.Service;
93 import fr.geom.core.entity.LineEntity;
94 import fr.geom.core.geometrie.Geometrie;
95 import fr.geom.core.repository.GeometryDaoInterface;
96
97 @Service
98 public class LineService implements GeometryServiceInterface {
99
100
101 @Resource
102 private GeometryDaoInterface lineDAO;
103
104 public LineEntity loadService(int id) {
105 return (LineEntity) lineDAO.load(id);
106 }
107
108 public void saveService(Geometrie line) {
109 lineDAO.save(line);
110 }
111 }
112
113 package fr.geom.core.service;
114
115 import javax.annotation.Resource;
116 import org.springframework.stereotype.Service;
117 import fr.geom.core.entity.PointEntity;
118 import fr.geom.core.geometrie.Geometrie;
119 import fr.geom.core.repository.GeometryDaoInterface;
120
121
122 @Service
123 public class PointService implements GeometryServiceInterface {
124
125 @Resource
126 private GeometryDaoInterface pointDAO;
127
128 public PointEntity loadService(int id) {
129 return (PointEntity) pointDAO.load(id);
130 }
131
132 public void saveService(Geometrie point) {
133 pointDAO.save(point);
134 }
135
136 }
137
138 package fr.geom.core.service;
139
140 import javax.annotation.Resource;
141 import org.springframework.stereotype.Service;
142 import fr.geom.core.entity.PolygoneEntity;
143 import fr.geom.core.geometrie.Geometrie;
144 import fr.geom.core.repository.GeometryDaoInterface;
145
146 @Service
147 public class PolygoneService implements GeometryServiceInterface {
148
149 @Resource
150 private GeometryDaoInterface polygoneDAO;
151
152 public PolygoneEntity loadService(int id) {
153 return (PolygoneEntity) polygoneDAO.load(id);
154 }
155
156 public void saveService(Geometrie polygone) {
157 polygoneDAO.save(polygone);
158 }
159
160 }
161
162
163 package fr.geom.core.repository;
164
165 import fr.geom.core.geometrie.Geometrie;
166
167 public interface GeometryDaoInterface {
168
169 public void save(Geometrie geometry);
170 public Geometrie load(int id);
171 }
172 package fr.geom.core.repository;
173
174 import javax.annotation.Resource;
175 import org.hibernate.Session;
176 import org.hibernate.SessionFactory;
177 import org.springframework.stereotype.Repository;
178 import fr.geom.core.entity.LineEntity;
179 import fr.geom.core.geometrie.Geometrie;
180 import fr.geom.core.util.HibernateUtil;
181
182 @Repository
183 public class LineDAO implements GeometryDaoInterface {
184
185 @Resource
186 private SessionFactory sessionFactory = (SessionFactory) HibernateUtil.getSessionFactory().getCurrentSession();
187
188 public void save(Geometrie line) {
189
190 try {
191 Session session = sessionFactory.openSession();
192 session.beginTransaction();
193 session.save(line);
194 session.getTransaction().commit();
195 session.close();
196
197 } catch (Exception e) {
198 // TODO: handle exception
199 }
200 }
201 public LineEntity load(int id) {
202 LineEntity line = null;
203 try {
204 Session session = sessionFactory.openSession();
205 session.beginTransaction();
206 line = (LineEntity) session.load(LineEntity.class, id);
207 session.getTransaction().commit();
208 session.close();
209
210 } catch (Exception e) {
211 // TODO: handle exception
212 }
213
214 return line;
215 }
216 }
217
218 package fr.geom.core.repository;
219
220 import javax.annotation.Resource;
221 import org.hibernate.Session;
222 import org.hibernate.SessionFactory;
223 import org.springframework.stereotype.Repository;
224 import fr.geom.core.entity.PointEntity;
225 import fr.geom.core.geometrie.Geometrie;
226 import fr.geom.core.util.HibernateUtil;
227
228 @Repository
229 public class PointDAO implements GeometryDaoInterface {
230
231 @Resource
232 private SessionFactory sessionFactory = (SessionFactory) HibernateUtil.getSessionFactory().getCurrentSession();
233
234 public void save(Geometrie point) {
235
236 try {
237 Session session = sessionFactory.openSession();
238 session.beginTransaction();
239 session.save(point);
240 session.getTransaction().commit();
241 session.close();
242
243 } catch (Exception e) {
244 // TODO: handle exception
245 }
246
247 }
248 public PointEntity load(int id) {
249 PointEntity point = null;
250
251 try {
252 Session session = sessionFactory.openSession();
253 session.beginTransaction();
254 point = (PointEntity) session.load(PointEntity.class, id);
255 session.getTransaction().commit();
256 session.close();
257
258 } catch (Exception e) {
259 // TODO: handle exception
260 }
261
262 return point;
263 }
264 }
265 package fr.geom.core.repository;
266
267 import javax.annotation.Resource;
268 import org.hibernate.Session;
269 import org.hibernate.SessionFactory;
270 import org.springframework.stereotype.Repository;
271 import fr.geom.core.entity.PolygoneEntity;
272 import fr.geom.core.geometrie.Geometrie;
273 import fr.geom.core.util.HibernateUtil;
274
275 @Repository
276 public class PolygoneDAO implements GeometryDaoInterface {
277
278 @Resource
279 private SessionFactory sessionFactory = (SessionFactory) HibernateUtil.getSessionFactory().getCurrentSession();
280
281 public void save(Geometrie polygone) {
282
283 try {
284 Session session = sessionFactory.openSession();
285 session.beginTransaction();
286 session.save(polygone);
287 session.getTransaction().commit();
288 session.close();
289
290 } catch (Exception e) {
291 // TODO: handle exception
292 }
293
294 }
295
296 public PolygoneEntity load(int id) {
297 PolygoneEntity polygone = null ;
298 try {
299 Session session = sessionFactory.openSession();
300 session.beginTransaction();
301 polygone = (PolygoneEntity) session.load(PolygoneEntity.class, id);
302 session.getTransaction().commit();
303 session.close();
304
305 } catch (Exception e) {
306 // TODO: handle exception
307 }
308 return polygone;
309 }package fr.geom.core.entity;
310
311 public class Coordinate {
312
313 private int idCoordinate;
314 private double x;
315 private double y;
316
317 public Coordinate() {
318
319 }
320
321 public int getIdCoordinate() {
322 return idCoordinate;
323 }
324
325 public void setIdCoordinate(int idCoordinate) {
326 this.idCoordinate = idCoordinate;
327 }
328
329 public double getX() {
330 return x;
331 }
332
333 public void setX(double x) {
334 this.x = x;
335 }
336
337 public double getY() {
338 return y;
339 }
340
341 public void setY(double y) {
342 this.y = y;
343 }
344 }
345
346 package fr.geom.core.entity;
347
348 import java.util.Set;
349
350 import fr.geom.core.geometrie.Geometrie;
351
352 public class LineEntity implements Geometrie{
353
354 private int idLine;
355 private Set<PointEntity> line;
356
357 public LineEntity(){
358 }
359 public int getIdLine() {
360 return idLine;
361 }
362 public void setIdLine(int idLine) {
363 this.idLine = idLine;
364 }
365 public Set<PointEntity> getLine() {
366 return line;
367 }
368
369 public void setLine(Set<PointEntity> line) {
370 this.line = line;
371 }
372 public String GeoToWkt() {
373 // TODO Auto-generated method stub
374 return null;
375 }
376 public String GeomToGeoJSON() {
377 // TODO Auto-generated method stub
378 return null;
379 }
380 public String GeomToGml() {
381 // TODO Auto-generated method stub
382 return null;
383 }
384 }
385
386 package fr.geom.core.entity;
387
388 import fr.geom.core.entity.Coordinate;
389 import fr.geom.core.geometrie.Geometrie;
390
391 public class PointEntity implements Geometrie{
392
393 private int idPoint;
394 private Coordinate coordinate;
395
396 public PointEntity(){
397 }
398 public int getIdPoint() {
399 return idPoint;
400 }
401 public void setIdPoint(int idPoint) {
402 this.idPoint = idPoint;
403 }
404 public Coordinate getCoordinate() {
405 return coordinate;
406 }
407 public void setCoordinate(Coordinate coordinate) {
408 this.coordinate = coordinate;
409 }
410
411 public String GeoToWkt() {
412 // TODO Auto-generated method stub
413 return null;
414 }
415
416 public String GeomToGeoJSON() {
417 // TODO Auto-generated method stub
418 return null;
419 }
420
421 public String GeomToGml() {
422 // TODO Auto-generated method stub
423 return null;
424 }
425 }
426
427 package fr.geom.core.entity;
428
429 import java.util.Set;
430 import fr.geom.core.geometrie.Geometrie;
431
432 public class PolygoneEntity implements Geometrie{
433
434 private int idPolygone;
435 private Set<PointEntity> polygone;
436
437 public PolygoneEntity(){
438 }
439 public int getIdPolygone() {
440 return idPolygone;
441 }
442 public void setIdPolygone(int idPolygone) {
443 this.idPolygone = idPolygone;
444 }
445 public Set<PointEntity> getPolygone() {
446 return polygone;
447 }
448 public void setPolygone(Set<PointEntity> polygone) {
449 this.polygone = polygone;
450 }
451 public String GeoToWkt() {
452 // TODO Auto-generated method stub
453 return null;
454 }
455 public String GeomToGeoJSON() {
456 // TODO Auto-generated method stub
457 return null;
458 }
459 public String GeomToGml() {
460 // TODO Auto-generated method stub
461 return null;
462 }
463 }
464
465 package fr.geom.core.controller;
466
467 public interface GeometryControllerInterface {
468
469 public void registerGeometrie();
470 public void showGeometrie();
471 }
472
473 package fr.geom.core.controller;
474
475 import java.util.Scanner;
476 import javax.annotation.Resource;
477 import org.springframework.stereotype.Controller;
478 import fr.geom.core.entity.LineEntity;
479 import fr.geom.core.service.GeometryServiceInterface;
480
481 @Controller
482 public class LineController implements GeometryControllerInterface {
483
484
485 @Resource
486 private GeometryServiceInterface lineService;
487 private static final Scanner key = new Scanner(System.in);
488
489 public void registerGeometrie() {
490 LineEntity line = new LineEntity();
491 System.out.println("___________________________");
492 System.out.println("Quel est l'identifiant de la line ?");
493 int id = key.nextInt();
494 line.setIdLine(id);
495 lineService.saveService(line);
496 System.out.println("___________________________");
497 System.out.println(" sauvegarde reussi .........");
498 }
499
500 public void showGeometrie() {
501 System.out.println("___________________________");
502 System.out.println("Quel est l'identifiant de la line ? ");
503 int id = key.nextInt();
504 lineService.loadService(id);
505 System.out.println("___________________________");
506 System.out.println(" chargement reussi ..^.. ");
507 }
508
509 }
510
511 package fr.geom.core.controller;
512
513 import java.util.Scanner;
514 import javax.annotation.Resource;
515 import org.springframework.stereotype.Controller;
516 import fr.geom.core.entity.PointEntity;
517 import fr.geom.core.entity.Coordinate;
518 import fr.geom.core.service.GeometryServiceInterface;
519
520 @Controller
521 public class PointController implements GeometryControllerInterface{
522
523 @Resource
524 private GeometryServiceInterface pointService;
525 private static final Scanner key = new Scanner(System.in);
526
527 public void registerGeometrie() {
528 PointEntity point = new PointEntity();
529 Coordinate coordinate = new Coordinate();
530 System.out.println("___________________________");
531 System.out.println("Quel est l'identifiant de la line ?");
532 int id = key.nextInt();
533 point.setIdPoint(id);;
534 pointService.saveService(point);
535 System.out.println("Quelle est la valeur de X ? ");
536 double x = key.nextDouble();
537 coordinate.setX(x);
538 System.out.println("Quelle est la valeur de Y ? ");
539 double y = key.nextDouble();
540 coordinate.setY(y);
541 point.setCoordinate(coordinate);
542 System.out.println("___________________________");
543 System.out.println(" sauvegarde reussi .........");
544 }
545
546 public void showGeometrie() {
547 System.out.println("___________________________");
548 System.out.println("Quel est l'identifiant du Point ? ");
549 int id = key.nextInt();
550 pointService.loadService(id);
551 System.out.println("___________________________");
552 System.out.println(" chargement reussi ..^.. ");
553 }
554 }
555
556 package fr.geom.core.controller;
557
558 import java.util.Scanner;
559 import javax.annotation.Resource;
560 import org.springframework.stereotype.Controller;
561 import fr.geom.core.entity.PolygoneEntity;
562 import fr.geom.core.service.GeometryServiceInterface;
563
564 @Controller
565 public class PolygoneController implements GeometryControllerInterface {
566
567 @Resource
568 private GeometryServiceInterface polygoneService;
569 private static final Scanner key = new Scanner(System.in);
570
571 public void registerGeometrie() {
572 PolygoneEntity polygone = new PolygoneEntity();
573 System.out.println("___________________________");
574 System.out.println("Quel est l'identifiant du Polygone ?");
575 int id = key.nextInt();
576 polygone.setIdPolygone(id);
577 polygoneService.saveService(polygone);
578 System.out.println("___________________________");
579 System.out.println(" sauvegarde reussi .........");
580 }
581
582 public void showGeometrie() {
583 System.out.println("___________________________");
584 System.out.println("Quel est l'identifiant du Polygone ? ");
585 int id = key.nextInt();
586 polygoneService.loadService(id);
587 System.out.println("___________________________");
588 System.out.println(" chargement reussi ..^.. ");
589 }
590 }
591
592 package fr.geom.core;
593
594 import org.springframework.context.ApplicationContext;
595 import org.springframework.context.support.ClassPathXmlApplicationContext;
596 import fr.geom.core.controller.LineController;
597 import fr.geom.core.controller.PointController;
598 import fr.geom.core.controller.PolygoneController;
599
600 /**
601 * App
602 *
603 */
604 public class App
605 {
606 public static void main( String[] args )
607 {
608 @SuppressWarnings("resource")
609 ApplicationContext context = new ClassPathXmlApplicationContext("ApplicationContext.xml");
610
611 PointController pointController = (PointController) context.getBean("pointController");
612 pointController.registerGeometrie();
613 pointController.showGeometrie();
614
615 LineController lineController = (LineController) context.getBean("lineController");
616 lineController.registerGeometrie();
617 lineController.showGeometrie();
618
619 PolygoneController polygoneController = (PolygoneController) context.getBean("polygoneController");
620 polygoneController.registerGeometrie();
621 pointController.showGeometrie();
622 }
623 }
624
625 <?xml version="1.0" encoding="UTF-8"?>
626 <!DOCTYPE hibernate-mapping PUBLIC
627 "-//Hibernate/Hibernate Mapping DTD//EN"
628 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
629
630 <hibernate-mapping>
631 <class name="fr.geom.core.entity.Coordinate" table="COORDINATES">
632 <id name="idCoordinate" column="ID_Coordinate">
633 <generator class="identity">
634 </generator>
635 </id>
636 <property name="x" column="X"></property>
637 <property name="y" column="Y"></property>
638 </class>
639 </hibernate-mapping>
640
641 <?xml version="1.0" encoding="UTF-8"?>
642 <!DOCTYPE hibernate-mapping PUBLIC
643 "-//Hibernate/Hibernate Mapping DTD//EN"
644 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
645
646 <hibernate-mapping>
647 <class name="fr.geom.core.entity.LineEntity" table="LINES">
648 <id name="idLine" column="ID_LINE">
649 <generator class="identity">
650 </generator>
651 </id>
652 <set name="line" table="LINE_POINT">
653 <key column="idLine"/>
654 <many-to-many class="fr.geom.core.entity.PointEntity" column="idPoint"/>
655 </set>
656 </class>
657 </hibernate-mapping>
658
659 <?xml version="1.0" encoding="UTF-8"?>
660 <!DOCTYPE hibernate-mapping PUBLIC
661 "-//Hibernate/Hibernate Mapping DTD//EN"
662 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
663
664 <hibernate-mapping>
665 <class name="fr.geom.core.entity.PointEntity" table="POINTS">
666 <id name="idPoint" column="ID_POINT">
667 <generator class="identity">
668 </generator>
669 </id>
670 <one-to-one name="coordinate" class="fr.geom.core.entity.Coordinate"
671 cascade="save-update"></one-to-one>
672 </class>
673 </hibernate-mapping>
674
675 <?xml version="1.0" encoding="UTF-8"?>
676 <!DOCTYPE hibernate-mapping PUBLIC
677 "-//Hibernate/Hibernate Mapping DTD//EN"
678 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
679
680 <hibernate-mapping>
681 <class name="fr.geom.core.entity.PolygoneEntity" table="POLYGONES">
682 <id name="idPolygone" column="ID_POLYGONE">
683 <generator class="identity">
684 </generator>
685 </id>
686 <set name="polygone" table="POLY_POINT">
687 <key column="idPolygone"/>
688 <many-to-many class="fr.geom.core.entity.PointEntity" column="idPoint"/>
689 </set>
690 </class>
691 </hibernate-mapping>
692
693<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
694 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
695 <modelVersion>4.0.0</modelVersion>
696 <groupId>GeomAppjhjk</groupId>
697 <artifactId>appl</artifactId>
698 <version>0.0.1-SNAPSHOT</version>
699 <packaging>jar</packaging>
700 <name>appl</name>
701 <url>http://maven.apache.org</url>
702 <properties>
703 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
704 </properties>
705 <dependencies>
706 <dependency>
707 <groupId>org.postgresql</groupId>
708 <artifactId>postgresql</artifactId>
709 <version>9.4-1200-jdbc41</version>
710 </dependency>
711 <dependency>
712 <groupId>org.springframework</groupId>
713 <artifactId>spring-core</artifactId>
714 <version>4.3.2.RELEASE</version>
715 </dependency>
716 <dependency>
717 <groupId>org.springframework</groupId>
718 <artifactId>spring-context</artifactId>
719 <version>4.3.2.RELEASE</version>
720 </dependency>
721 <dependency>
722 <groupId>org.springframework</groupId>
723 <artifactId>spring-expression</artifactId>
724 <version>4.3.2.RELEASE</version>
725 </dependency>
726 <dependency>
727 <groupId>org.springframework</groupId>
728 <artifactId>spring-beans</artifactId>
729 <version>4.3.2.RELEASE</version>
730 </dependency>
731 <dependency>
732 <groupId>org.hibernate</groupId>
733 <artifactId>hibernate-core</artifactId>
734 <version>5.0.2.Final</version>
735 </dependency>
736 <dependency>
737 <groupId>org.apache.logging.log4j</groupId>
738 <artifactId>log4j-api</artifactId>
739 <version>2.6.2</version>
740 </dependency>
741 <dependency>
742 <groupId>org.apache.logging.log4j</groupId>
743 <artifactId>log4j-core</artifactId>
744 <version>2.6.2</version>
745 </dependency>
746 <dependency>
747 <groupId>javassist</groupId>
748 <artifactId>javassist</artifactId>
749 <version>3.12.1.GA</version>
750 </dependency>
751 <dependency>
752 <groupId>org.slf4j</groupId>
753 <artifactId>slf4j-log4j12</artifactId>
754 <version>1.7.12</version>
755 </dependency>
756 <dependency>
757 <groupId>org.springframework</groupId>
758 <artifactId>spring-jdbc</artifactId>
759 <version>4.3.2.RELEASE</version>
760 </dependency>
761 <dependency>
762 <groupId>org.springframework</groupId>
763 <artifactId>spring-tx</artifactId>
764 <version>4.3.2.RELEASE</version>
765 </dependency>
766 <dependency>
767 <groupId>org.springframework</groupId>
768 <artifactId>spring-aop</artifactId>
769 <version>4.3.2.RELEASE</version>
770 </dependency>
771 <dependency>
772 <groupId>org.springframework</groupId>
773 <artifactId>spring-orm</artifactId>
774 <version>4.3.2.RELEASE</version>
775 </dependency>
776 <dependency>
777 <groupId>commons-pool</groupId>
778 <artifactId>commons-pool</artifactId>
779 <version>1.6</version>
780 </dependency>
781 <dependency>
782 <groupId>commons-dbcp</groupId>
783 <artifactId>commons-dbcp</artifactId>
784 <version>1.4</version>
785 </dependency>
786 <dependency>
787 <groupId>junit</groupId>
788 <artifactId>junit</artifactId>
789 <version>3.8.1</version>
790 <scope>test</scope>
791 </dependency>
792 <dependency>
793 <groupId>org.hibernate</groupId>
794 <artifactId>hibernate-entitymanager</artifactId>
795 <version>5.0.2.Final</version>
796 </dependency>
797 </dependencies>
798 </project>
799
8002016-08-08 10:34:39 INFO ClassPathXmlApplicationContext:581 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@291972f8: startup date [Mon Aug 08 10:34:39 CEST 2016]; root of context hierarchy
8012016-08-08 10:34:39 INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from class path resource [ApplicationContext.xml]
8022016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
8032016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
8042016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:529 - Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references
8052016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:484 - Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
8062016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
8072016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
8082016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:529 - Eagerly caching bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' to allow for resolving potential circular references
8092016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:484 - Finished creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
8102016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
8112016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
8122016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:529 - Eagerly caching bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' to allow for resolving potential circular references
8132016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:484 - Finished creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
8142016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
8152016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
8162016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:529 - Eagerly caching bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' to allow for resolving potential circular references
8172016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:484 - Finished creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
8182016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalPersistenceAnnotationProcessor'
8192016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'org.springframework.context.annotation.internalPersistenceAnnotationProcessor'
8202016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:529 - Eagerly caching bean 'org.springframework.context.annotation.internalPersistenceAnnotationProcessor' to allow for resolving potential circular references
8212016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:484 - Finished creating instance of bean 'org.springframework.context.annotation.internalPersistenceAnnotationProcessor'
8222016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
8232016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
8242016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:529 - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' to allow for resolving potential circular references
8252016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:484 - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
8262016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
8272016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
8282016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:529 - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' to allow for resolving potential circular references
8292016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:484 - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
8302016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:745 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1b6e60b7: defining beans [lineController,pointController,polygoneController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,lineService,pointService,polygoneService,lineDAO,pointDAO,polygoneDAO,sessionFactory,dataSource,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy
8312016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'lineController'
8322016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'lineController'
8332016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:529 - Eagerly caching bean 'lineController' to allow for resolving potential circular references
8342016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'lineService'
8352016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'lineService'
8362016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:529 - Eagerly caching bean 'lineService' to allow for resolving potential circular references
8372016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'lineDAO'
8382016-08-08 10:34:39 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'lineDAO'
839ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
840Hibernate:
841 alter table LINE_POINT
842 drop constraint FKr9leyoj8dx4dgeny8vlkcktj6
84310:34:42.014 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table LINE_POINT drop constraint FKr9leyoj8dx4dgeny8vlkcktj6
84410:34:42.016 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - ERROR: relation "line_point" does not exist
845Hibernate:
846 alter table LINE_POINT
847 drop constraint FKt6peoljxcllnf73vhg0afdkco
84810:34:42.017 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table LINE_POINT drop constraint FKt6peoljxcllnf73vhg0afdkco
84910:34:42.017 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - ERROR: relation "line_point" does not exist
850Hibernate:
851 alter table POLY_POINT
852 drop constraint FK9osmn1ou9viwdivi798xhd7lf
85310:34:42.017 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table POLY_POINT drop constraint FK9osmn1ou9viwdivi798xhd7lf
85410:34:42.017 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - ERROR: relation "poly_point" does not exist
855Hibernate:
856 alter table POLY_POINT
857 drop constraint FK9g9qmfbc78r5y42p0rcbe5par
85810:34:42.018 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table POLY_POINT drop constraint FK9g9qmfbc78r5y42p0rcbe5par
85910:34:42.018 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - ERROR: relation "poly_point" does not exist
860Hibernate:
861 drop table if exists COORDINATES cascade
862Hibernate:
863 drop table if exists LINE_POINT cascade
864Hibernate:
865 drop table if exists LINES cascade
866Hibernate:
867 drop table if exists POINTS cascade
868Hibernate:
869 drop table if exists POLY_POINT cascade
870Hibernate:
871 drop table if exists POLYGONES cascade
872Hibernate:
873 create table COORDINATES (
874 ID_Coordinate serial not null,
875 X float8,
876 Y float8,
877 primary key (ID_Coordinate)
878 )
879Hibernate:
880 create table LINE_POINT (
881 idLine int4 not null,
882 idPoint int4 not null,
883 primary key (idLine, idPoint)
884 )
885Hibernate:
886 create table LINES (
887 ID_LINE serial not null,
888 primary key (ID_LINE)
889 )
890Hibernate:
891 create table POINTS (
892 ID_POINT serial not null,
893 primary key (ID_POINT)
894 )
895Hibernate:
896 create table POLY_POINT (
897 idPolygone int4 not null,
898 idPoint int4 not null,
899 primary key (idPolygone, idPoint)
900 )
901Hibernate:
902 create table POLYGONES (
903 ID_POLYGONE serial not null,
904 primary key (ID_POLYGONE)
905 )
906Hibernate:
907 alter table LINE_POINT
908 add constraint FKr9leyoj8dx4dgeny8vlkcktj6
909 foreign key (idPoint)
910 references POINTS
911Hibernate:
912 alter table LINE_POINT
913 add constraint FKt6peoljxcllnf73vhg0afdkco
914 foreign key (idLine)
915 references LINES
916Hibernate:
917 alter table POLY_POINT
918 add constraint FK9osmn1ou9viwdivi798xhd7lf
919 foreign key (idPoint)
920 references POINTS
921Hibernate:
922 alter table POLY_POINT
923 add constraint FK9g9qmfbc78r5y42p0rcbe5par
924 foreign key (idPolygone)
925 references POLYGONES
9262016-08-08 10:34:42 WARN ClassPathXmlApplicationContext:549 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineDAO' defined in file [/home/amiri/Bureau/USB/Geom application/GeomApp/target/classes/fr/geom/core/repository/LineDAO.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [fr.geom.core.repository.LineDAO]: Constructor threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy30 cannot be cast to org.hibernate.SessionFactory
9272016-08-08 10:34:42 DEBUG DefaultListableBeanFactory:512 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1b6e60b7: defining beans [lineController,pointController,polygoneController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,lineService,pointService,polygoneService,lineDAO,pointDAO,polygoneDAO,sessionFactory,dataSource,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy
928Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineDAO' defined in file [/home/amiri/Bureau/USB/Geom application/GeomApp/target/classes/fr/geom/core/repository/LineDAO.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [fr.geom.core.repository.LineDAO]: Constructor threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy30 cannot be cast to org.hibernate.SessionFactory
929 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:321)
930 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
931 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
932 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
933 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
934 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
935 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
936 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
937 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)
938 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
939 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
940 at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
941 at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
942 at fr.geom.core.App.main(App.java:18)
943Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineDAO' defined in file [/home/amiri/Bureau/USB/Geom application/GeomApp/target/classes/fr/geom/core/repository/LineDAO.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [fr.geom.core.repository.LineDAO]: Constructor threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy30 cannot be cast to org.hibernate.SessionFactory
944 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:321)
945 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
946 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
947 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
948 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
949 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
950 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
951 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
952 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:522)
953 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:496)
954 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:627)
955 at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:169)
956 at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
957 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:318)
958 ... 13 more
959Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineDAO' defined in file [/home/amiri/Bureau/USB/Geom application/GeomApp/target/classes/fr/geom/core/repository/LineDAO.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [fr.geom.core.repository.LineDAO]: Constructor threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy30 cannot be cast to org.hibernate.SessionFactory
960 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105)
961 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050)
962 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
963 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
964 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
965 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
966 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
967 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
968 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:522)
969 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:496)
970 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:627)
971 at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:169)
972 at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
973 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:318)
974 ... 26 more
975Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [fr.geom.core.repository.LineDAO]: Constructor threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy30 cannot be cast to org.hibernate.SessionFactory
976 at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
977 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
978 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1098)
979 ... 39 more
980Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy30 cannot be cast to org.hibernate.SessionFactory
981 at fr.geom.core.repository.LineDAO.<init>(LineDAO.java:14)
982 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
983 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
984 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
985 at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
986 at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
987 ... 41 more