Another issue with CMP Inheritance:

CMP Inheritance demo (
http://caucho.com/resin-3.1/examples/amber-inherit/index.xtp) must return
Student name, but it returns all records with type instead of name:
Students Student[student]
Student[prefect]
Student[prefect]




2007/10/10, Sergey Plehov <[EMAIL PROTECTED]>:
>
> Hi
>
> I find and issue with CMP Inheritance and named queries.
> If in Example CMP Inheritance 
> (http://caucho.com/resin-3.1/examples/amber-inherit/index.xtp
> ) in class Student.java define named query, i got the following exception
>
> com.caucho.config.ConfigException: Named query 'findByName': 'select
> o from Student o where o.name=:name' is already defined.
>
>
> Source code:
>
> package example;
>
> import javax.persistence.*;
>
> /**
>  * Implementation class for the Student bean.
>  *
>  * <code><pre>
>  * CREATE TABLE amber_inherit_student (
>
>  *   id INTEGER PRIMARY KEY auto_increment,
>  *   type VARCHAR(10),
>  *   name VARCHAR(250),
>  * );
>  * </pre></code>
>  */
> @Entity
> @Table(name="amber_inherit_student")
> @Inheritance
>
> @DiscriminatorValue("student")
> @DiscriminatorColumn(name="type")
> @NamedQuery(name = "findByName", query = "select o from Student o where 
> o.name=:name") \\ test named query
>
> public class Student {
>   @Id
>   @Column(name="id")
>   @GeneratedValue
>   private long _id;
>
>   @Basic
>   @Column(unique=true, nullable=false)
>   private String _name;
>
>   public Student()
>
>   {
>   }
>
>   public Student(String name)
>   {
>     _name = name;
>   }
>
>   /**
>    * Returns the name.
>    */
>   public String getName()
>   {
>     return _name;
>   }
>
>   public String toString()
>
>   {
>     return "Student[" + _name + "]";
>   }
> }
>
>
>
>
> -------------------------------
> Sergey Plehov




-- 
-------------------------------
Sergey Plehov
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to