К примеру у нас есть сущность Пользователь, которая в БД представлена таблицей USER с полями ID и NAME. Кроме идентификатора и имени соответственно у пользователя может быть включен какой-то набор опций. Т.к. один пользователь может иметь много опций и одна опция может принадлежать многим пользователям, то это связь называется многие-ко-многим. Для того чтобы представить эту связь в БД нужна дополнительная таблица USER_OPTIONS c с полями USER_ID и OPTION_ID. Ниже представлен класс UserDTO, который отображается на таблицу USER.
Показаны сообщения с ярлыком Hibernate. Показать все сообщения
Показаны сообщения с ярлыком Hibernate. Показать все сообщения
Caused by: java.sql.SQLException: Connection handle has been closed and is unusable
Error:
23:37:54,980 INFO [STDOUT] 23:37:54,970 INFO [DefaultLoadEventListener] Error performing load command org.hibernate.exception.GenericJDBCException: could not load an entity: [com.app.model.ExampleEntity#Example.dat] at org.hibernate.exception.SQLStateConverter. handledNonSpecificException(SQLStateConverter.java:103) at java.lang.Thread.run(Thread.java:662) Caused by: java.sql.SQLException: Connection handle has been closed and is unusable at org.jboss.resource.adapter.jdbc.WrappedConnection. checkStatus(WrappedConnection.java:845) ... 57 more 23:37:55,101 INFO [STDOUT] 23:37:55,101 ERROR [LoggingHandler] org.springframework.integration.MessageHandlingException: javax. persistence.PersistenceException: org.hibernate.exception. GenericJDBCException: could not load an entity: [com.app.model. ExampleEntity#Example.dat] at org.springframework.integration.handler. MethodInvokingMessageProcessor.processMessage( MethodInvokingMessageProcessor.java:76) at java.lang.Thread.run(Thread.java:662) Caused by: javax.persistence.PersistenceException: org.hibernate. exception.GenericJDBCException: could not load an entity: [com. app.model.ExampleEntity#Example.dat] at org.hibernate.ejb.AbstractEntityManagerImpl. throwPersistenceException(AbstractEntityManagerImpl.java:614) ... 31 more Caused by: org.hibernate.exception.GenericJDBCException: could not load an entity: [com.app.model.ExampleEntity#Example.dat] at org.hibernate.exception.SQLStateConverter. handledNonSpecificException(SQLStateConverter.java:103) ... 45 more Caused by: java.sql.SQLException: Connection handle has been closed and is unusable at org.jboss.resource.adapter.jdbc.WrappedConnection. checkStatus(WrappedConnection.java:845)
No JTA UserTransaction available - specify either 'userTransaction' or 'userTransactionName' or 'transactionManager' or 'transactionManagerName'
Errors:
21:50:06,151 INFO [STDOUT] 21:50:06,151 ERROR [ContextLoader] Context initialization failed org.springframework.beans. factory.BeanCreationException: Error creating bean with name 'txManager' defined in class path resource [oper-applicationContext.xml]: Invocation of init method failed; nested exception is java.lang. IllegalStateException: No JTA UserTransaction available - specify either 'userTransaction' or 'userTransactionName' or 'transactionManager' or 'transactionManagerName'
[LoggingHandler] org.springframework.integration.MessageHandlingException: java.lang.IllegalArgumentException: Unknown entity
Error:
01:52:45,877 INFO [STDOUT] 01:52:45,877 INFO [NamingHelper] JNDI InitialContext properties:{} 01:52:46,849 INFO [STDOUT] 01:52:46,849 ERROR [LoggingHandler] org.springframework.integration.MessageHandlingException: java.lang.IllegalArgumentException: Unknown entity: com.model.ExampleEntity at org.springframework.integration.handler. MethodInvokingMessageProcessor.processMessage( MethodInvokingMessageProcessor.java:76) at org.springframework.integration.filter. AbstractMessageProcessingSelector.accept( AbstractMessageProcessingSelector.java:59)
Подписаться на:
Сообщения (Atom)