-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: mysql - on-to-many set - simples problem..
PostPosted: Wed Jun 29, 2005 11:00 am 
Newbie

Joined: Wed Jun 29, 2005 10:53 am
Posts: 2
hallo,

ich sitz schon 2 (zwei) tage an ner simplen one-to-many bindung.
also, ich habe 2 tabellen:

CREATE TABLE `file` (
`fileid` int(11) NOT NULL default '0',
`filename` varchar(60) NOT NULL default '',
`path` varchar(100) NOT NULL default '',
`format` int(11) NOT NULL default '0',
`moveid` int(11) NOT NULL default '0',
`discid` int(11) NOT NULL default '0',
PRIMARY KEY (`fileid`)
) TYPE=MyISAM;

CREATE TABLE `movie` (
`movieid` int(11) NOT NULL default '0',
`title` varchar(60) NOT NULL default '',
`description` varchar(160) NOT NULL default '',
`url` varchar(60) NOT NULL default '',
`imdbid` varchar(9) NOT NULL default '',
`genre` int(11) NOT NULL default '0',
`rating` int(11) NOT NULL default '0',
PRIMARY KEY (`movieid`)
) TYPE=MyISAM;

so, und in file ist ein foreign key "movieid" nach movie...

das ganze will ich folgendermassen mappen:

<class name="Movie" table="movie">
<id name="movieid" column="movieid" type="java.lang.Integer">
<generator class="native"/>
</id>
.....
<set name="files">
<key column="movieid" />
<one-to-many class="File" />
</set>
</class>

<class name="File" table="file">
<id name="fileid" column="fileid" type="java.lang.Integer">
<generator class="native"/>
</id>
....
<many-to-one name="movie" column="moveid" class="Movie" not-null="true" />
</class>


als fehler bekomm ich aber leider:

net.sf.hibernate.exception.SQLGrammarException: could not initialize collection: [de.seidbereit.medialibrary.hibernate.Movie.files#0]
....
Caused by: java.sql.SQLException: Unknown column 'files0_.movieid' in 'field list'
....



hab auch schon versucht das set als
<set name="files" table="file">
<key column="movieid" />
<one-to-many class="File" />
</set>
zu mappen...

alles geht nach hinten los. keine ahnung... :(

danke schonmal!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 11:08 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Wenn ich mir so die Fehlermeldung ansehe, wird der Fehler schnell deutlich.

"Unknown column 'files0_.movieid' in 'field list'"

Es wird also die Spalte "movieid" nicht gefunden. Gibt es die Spalte "movieid" in der Tabelle "file"? Nein!

CREATE TABLE `file` (
`fileid` int(11) NOT NULL default '0',
`filename` varchar(60) NOT NULL default '',
`path` varchar(100) NOT NULL default '',
`format` int(11) NOT NULL default '0',
`moveid` int(11) NOT NULL default '0',
`discid` int(11) NOT NULL default '0',
PRIMARY KEY (`fileid`)
) TYPE=MyISAM;


Schöne Grüße
Sven


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 11:46 am 
Newbie

Joined: Wed Jun 29, 2005 10:53 am
Posts: 2
lord!

unglaublich, 1000000dank!
echt zwei tage!! ;)

looord!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.