tags:

views:

27

answers:

1

I'm creating a web project under wicket, Spring, Hibernate, Oracle 11. I have an error, please help to resolve it. This is my config file:

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:jndi="http://www.springframework.org/schema/jndi"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-2.0.xsd 
    http://www.springframework.org/schema/tx  
    http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.springframework.org/schema/jndi 
    http://www.springframework.org/schema/jndi/spring-jndi.xsd 
    http://www.springframework.org/schema/util 
    http://www.springframework.org/schema/util/spring-util-2.0.xsd"&gt;

    <bean id="placeholderConfig"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location">
            <value>classpath:application.properties</value>
        </property>
        <property name="systemPropertiesModeName">
            <value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
        </property>
    </bean>

    <bean id="dataSource"
        class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass">
            <value>${jdbc.driver}</value>
        </property>
        <property name="jdbcUrl">
            <value>${jdbc.url}</value>
        </property>
        <property name="user">
            <value>${jdbc.username}</value>
        </property>
        <property name="password">
            <value>${jdbc.password}</value>
        </property>
        <property name="minPoolSize">
            <value>${c3p0.minPoolSize}</value>
        </property>
        <property name="maxPoolSize">
            <value>${c3p0.maxPoolSize}</value>
        </property>
        <property name="checkoutTimeout">
            <!-- Give up waiting for a connection after this many milliseconds -->
            <value>20000</value>
        </property>
        <property name="maxIdleTime">
            <value>${c3p0.maxIdleTime}</value>
        </property>
        <property name="idleConnectionTestPeriod">
            <value>${c3p0.idleConnectionTestPeriod}</value>
        </property>
        <property name="automaticTestTable">
            <value>${c3p0.automaticTestTable}</value>
        </property>
    </bean>

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        <property name="annotatedClasses">
            <list>
                <value>
                    wicket.in.action.chapter13.dbdiscounts.domain.User
                </value>
                <value>
                    wicket.in.action.chapter13.dbdiscounts.domain.Cheese
                </value>
                <value>
                    wicket.in.action.chapter13.dbdiscounts.domain.Discount
                </value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    ${hibernate.dialect}
                </prop>
            </props>
        </property>
    </bean>

    <!-- setup transaction manager  -->
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>
    <!-- ells Spring to put transactional advice on any class or method that has an @Transactional annotation on it  -->
    <tx:annotation-driven />

    <bean id="wicketApplication"
        class="wicket.in.action.chapter03.section_3_1.CheesrApplication">
    </bean>

    <bean id="TestDataInitializer"
        class="wicket.in.action.chapter13.dbdiscounts.TestDataInitializer">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <bean id="CheeseDao"
        class="wicket.in.action.chapter13.dbdiscounts.dao.hibernate.CheeseDaoImpl">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <bean id="DiscountDao"
        class="wicket.in.action.chapter13.dbdiscounts.dao.hibernate.DiscountDaoImpl">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <bean id="UserDao"
        class="wicket.in.action.chapter13.dbdiscounts.dao.hibernate.UserDaoImpl">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <bean id="GenericDao"
        class="wicket.in.action.chapter13.dbdiscounts.dao.hibernate.GenericDaoImpl">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <bean id="DiscountsService"
        class="wicket.in.action.chapter13.dbdiscounts.services.DiscountsServiceImpl">
        <property name="cheeseDao" ref="CheeseDao" />
        <property name="discountDao" ref="DiscountDao" />
        <property name="userDao" ref="UserDao" />
        <property name="genericDao" ref="GenericDao" />
    </bean>

</beans>

User.java:

@Entity
@Table(name="users")
public class User implements DomainObject {
    @Id
    private Long id;    

    private boolean admin = false;

    @Column(name="name")
    private String fullname;
    @Column(name="passw")
    private String wiaPassword;
    @Column(name="login")
    private String wiaUsername;

  public User() {
  }

  public User(String username, String password, String fullname,
      boolean isAdmin) {
    this.wiaUsername = username;
    this.wiaPassword = password;
    this.fullname = fullname;
    this.admin = isAdmin;
  }

  public String getFullname() {
    return fullname;
  }

  public String getWiaPassword() {
    return wiaPassword;
  }

  public String getWiaUsername() {
    return wiaUsername;
  }

  public boolean isAdmin() {
    return admin;
  }

  public void setAdmin(boolean admin) {
    this.admin = admin;
  }

  public void setFullname(String fullname) {
    this.fullname = fullname;
  }

  public void setWiaPassword(String password) {
    this.wiaPassword = password;
  }

  public void setWiaUsername(String username) {
    this.wiaUsername = username;
  }

  public Long getId() {
        return id;
  }
}

What this may mean?

WicketMessage: Error attaching this container for rendering: [Page class = tj.eskhata.pos.Page2, id = 7, version = 0]
    Root cause:java.sql.SQLSyntaxErrorException: ORA-00904: "THIS_"."ADMIN": invalid identifier     at 
            oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)     at 
            oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)     at 
            oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)     at
        ... 
A: 

Check your code for the place where the (sub-)string "THIS_"."ADMIN" is created. Maybe you wanted THIS_.ADMIN or "THIS_.ADMIN" instead. In this case, simply remove the unnecessary quotes.

Andreas_D