Why is n_link be expressed as "int(11)"?
Is this how IDEA displays it?
I was expecting something like -
n_link INTEGER NOT NULL,
-Donald
On 4/21/10 6:03 PM, Dimedrol wrote:
>
> Hello!
> I use Intellij IDEA 95.24; OpenJPA 1.2.2 and MySQL 5 database.
>
> All java entities - mapped to mysql tables were created by IDEA wizard.
> Everything was OK, but I have met 1 strange problem:
>
> In one of my MySQL tables:
> -------------------
> CREATE TABLE kl_mytable (
> id_klmytable int(11) NOT NULL auto_increment,
> name char(100) NOT NULL,
> n_link int(11) NOT NULL,
> id_country int(11) NOT NULL,
> PRIMARY KEY (id_klmytable),
> KEY id_country (id_country),
> CONSTRAINT kl_mytable_fk FOREIGN KEY (id_country) REFERENCES country
> (id_country)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT
> -------------------
>
> there is a problem with the field "n_link".
>
>
>
> IDEA has generated a proper entity mapping:
>
> +++++++++++++++
> private Integer nLink;
>
> @javax.persistence.Column(name = "n_link")
> @Basic
> public Integer getnLink() {
> return nLink;
> }
>
> public void setnLink(Integer nLink) {
> this.nLink = nLink;
> }
> +++++++++++++++
>
>
>
> But in the logs I see:
>
> ===============
>
> 23797 NewPersistenceUnit TRACE [http-8080-Processor25] openjpa.MetaData -
> Initializing mapping for "server.domain.klmyta...@28318025".
> 23797 NewPersistenceUnit TRACE [http-8080-Processor25] openjpa.MetaData -
> Resolving field "[email protected]".
> 23797 NewPersistenceUnit TRACE [http-8080-Processor25] openjpa.MetaData -
> Resolving field "[email protected]".
> 23797 NewPersistenceUnit TRACE [http-8080-Processor25] openjpa.MetaData -
> Resolving field "[email protected]".
> 23797 NewPersistenceUnit TRACE [http-8080-Processor25] openjpa.MetaData -
> Resolving field "[email protected]".
>
> ===============
>
> It means, OpenJPA does not resolves this field "n_link" and in the Query it
> always returns NULL as its value.
>
> When I try do debug a little deeper, I also see - "no field named" exception
> about this "n_link" field,
> but IDEA sees this field and even helps me to create the Query with code
> completion, using this "absent" (like OpenJPA thinks) field.
>
>
> So, please, help.
> What am I doing wrong?
>
>
>