[Persistence, JBoss/CMP, Hibernate, Database] - error InitialContext - database error
by gomanza
Hi guys,
I have the following inital Method to fill my database everytime I start jboss-4.0.5:
| public void contextInitialized(ServletContextEvent arg0) {
| logger.info("ServletContext initialized, initialize DB.");
| InitialContext iCtx;
| try {
| iCtx = new InitialContext();
| internetShop = (InternetShopLocal) iCtx
| .lookup("InternetShop/InternetShop/local");
| } catch (NamingException exc) {
| throw new RuntimeException(exc);
| }
| List<EntityBean> mockEntities = new ArrayList<EntityBean>();
| User user = getMockUser();
| mockEntities.add(user);
|
| mockEntities.add(....);
| mockEntities.add(....);
| mockEntities.add(....);
| try {
| internetShop.saveMockEntities(mockEntities);
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
The Method getMockUser() returns a fille user Object
| public static User getMockUser() {
| User result = new User();
| result.setAccountNumber("01234");
| result.setAdmin(false);
| result.setBankName("Western Union");
| result.setBankNumber("43210");
| result.setCity("Gossersweiler Stein");
| result.setCompanyName("Feuchtraumbeseitigung");
| result.setEmail("deep(a)dami.sch");
| result.setHousenumber("12a");
| result.setLogin("user");
| result.setName("user");
| result.setPassword("asswd");
| result.setStreet("wersglaubt");
| result.setSurname("step");
| result.setZipcode("43012");
| return result;
| }
So I think my configurations are right cause the database structure is ok:
21:56:58,329 INFO [TableMetadata] table found: PUBLIC.USER
21:56:58,329 INFO [TableMetadata] columns: [password, banknumber, login, street, id, accountnumber, surname, bankname, companyname, housenumber, email, name, zipcode, admin, city]
21:56:58,329 INFO [TableMetadata] foreign keys: []
21:56:58,329 INFO [TableMetadata] indexes: [sys_pk_57, sys_idx_sys_ct_56_58]
21:56:58,344 INFO [SchemaUpdate] schema update complete
And this is the message I get every time:
Why are the values null and ??? that's not possible.
Anybody who has some ideas please let me know...
21:57:02,594 ERROR [STDERR] 18.07.2007 21:57:02 com.internetshop.InitializeDBCtxListener contextInitialized
INFO: ServletContext initialized, initialize DB.
21:57:03,204 INFO [STDOUT] Hibernate: insert into User (id, name, password, admin, login, accountNumber, bankName, bankNumber, city, companyName, email, housenumber, street, surname, zipcode) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
21:57:03,250 WARN [JDBCExceptionReporter] SQL Error: -104, SQLState: 23000
21:57:03,250 ERROR [JDBCExceptionReporter] Unique constraint violation: SYS_CT_56 in statement [insert into User (id, name, password, admin, login, accountNumber, bankName, bankNumber, city, companyName, email, housenumber, street, surname, zipcode) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
thanks Stephan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065558#4065558
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065558
18Â years, 11Â months
[JBoss Seam] - Uncomprehended Behavior
by vwu98034
The situation occurs on a user account login information retrieval. An action class takes an email address to retrieve the data. If the email address is incorrect for various reasons, the same screen/page will be redisplayed.
Other than a pair of getter and setter for the email address, there is only one method, called doIt, to do email address validation and data retrieval.
Here is the problem I can't comprehend. When I enter some characters, which is not in valid email format, the doIt method is executed and an error message is shown on the screen. Then, I type in an valid email format, but not in the DB. The doIt method MAY not be executed.
This situation occurs when I have the class in the event scope, or in the conversation scope and have the begin annotation with join=true on the setEmail method and the end annotation on the doIt method.
Can someone points me to a right direction for this problem, please?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065552#4065552
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065552
18Â years, 11Â months