geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mario Kofler" <mario.kof...@gmail.com>
Subject Re: error writing tuple to database "the owning entity is not mapped" geronimo 2.1.1
Date Mon, 07 Jul 2008 19:01:57 GMT
hi jacek,

thanks for your help, i did change my birthdate field to sql.Date now.
the error message remains. but i realized, that the error message just
appears at the first write operation: all following write operations
are executed successfully. i will try to make my tests, i think i'll
just ignore the first write action and start my tests from the 2nd
write operation on.

for the moment, thanks!

mario.

2008/7/6 Jacek Laskowski <jacek@laskowski.net.pl>:
> On Sun, Jul 6, 2008 at 11:34 AM, Mario Kofler <mario.kofler@gmail.com> wrote:
>>
>
> Hi Mario,
>
> Let's make it simpler by removing some unneeded, defaulted
> configuration values in your sample.
>
>> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>>             version="1.0">
>>  <persistence-unit name="valhalla" transaction-type="JTA">
>
> Hint: you may remove transaction-type as it's JTA in managed
> environment like Geronimo.
>
>>    <description>videothek</description>
>>    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
> Provider defaults to openjpa in Geronimo. You may remove it.
>
>>    <class>vt.bean.entity.Person</class>
>>    <class>vt.bean.entity.Actor</class>
>>    <class>vt.bean.entity.Director</class>
>>    <class>vt.bean.entity.Movie</class>
>>    <class>vt.bean.entity.Dvd</class>
>
> Not needed in managed environment like Geronimo. It makes things run
> faster - no need to look for annotated classes, but am not sure if we
> don't do this even though the class elements are specified.
>
> Also, you showed Person entity class, but what about the rest? Either
> remove them and let's play with a single entity only and add more
> later or show all of them as I think the issue might be in the others.
>
>>    <properties>
>>
>>      <property name="openjpa.jdbc.DBDictionary" value="postgres"/>
>>      <!--property name="openjpa.LockManager" value="pessimistic"/-->
>>    </properties>
>>    <jta-data-source>jdbc/postgres</jta-data-source>
>>    <non-jta-data-source>jdbc/postgres</non-jta-data-source>
>
> I think *data-source should be before properties element. Geronimo
> should really be more strict.
>
>> @Entity
>> @Table(name="person")
>> @Inheritance(strategy=InheritanceType.JOINED)
>> @DiscriminatorColumn(name="role", discriminatorType=DiscriminatorType.STRING)
>
> discriminatorType is defaulted to STRING.
>
>> @DiscriminatorValue("P")
>> public class Person implements java.io.Serializable
>> {
>>    private int id;
>>    private String name;
>>    private Calendar birthdate;
>>    private String origin;
>>
>>    @Id
>>    @GeneratedValue
>>    public int getId()
>>    {
>>        return id;
>>    }
>>
>>    public void setId(int id)
>>    {
>>        this.id = id;
>>    }
>>
>>    public String getName()
>>    {
>>        return name;
>>    }
>>
>>    public void setName(String name)
>>    {
>>        this.name = name;
>>    }
>>
>>    @Temporal(TemporalType.DATE)
>>    public Calendar getBirthdate()
>>    {
>>        return birthdate;
>>    }
>
> I think that's the issue - @Temporal. According to the spec - JSR 220:
> Enterprise JavaBeansTM,Version 3.0 Java Persistence API - page 234:
>
> <xsd:simpleType name="temporal-type">
> <xsd:annotation>
> <xsd:documentation>
> public enum TemporalType {
> DATE, // java.sql.Date
> TIME, // java.sql.Time
> TIMESTAMP // java.sql.Timestamp
> }
> </xsd:documentation>
> </xsd:annotation>
> <xsd:restriction base="xsd:token">
> <xsd:enumeration value="DATE"/>
> <xsd:enumeration value="TIME"/>
> <xsd:enumeration value="TIMESTAMP"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> so Calendar seems to not be accepted for @Temporal annotation. Change
> the return type of the getter.
>
> I think the Person entity is not mapped correctly and when you run
> your sample you are off the error messages which tell you the Person
> entity could not be mapped.
>
> Jacek
>
> --
> Jacek Laskowski
> Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl
>

Mime
View raw message