For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 9 replies, 3 voices, and was last updated 19 years, 10 months ago by
Brian Fernandes.
-
AuthorPosts
-
thurisazMemberHi everybody,
a few months ago I created a lot of SQL-Tables in Postgresql and when I used MyEclipse to create JavaBeans and Mapping files from these tables with “referenced”-table-attributes like
CREATE TABLE Category ( [...] father REFERENCES Category ON UPDATE CASCADE ON DELETE CASCADE, [...]MyEclipse created JavaBeans with an attribute named “father” which references another Java-Class from type “Category”.
private Category father;Today, using MyEclipse 4.1 I tried something simmilar using MySQL. When I create a table with
CREATE TABLE `Repository` ( [...] `owner` INTEGER NOT NULL, FOREIGN KEY (owner) REFERENCES user(userid) ON DELETE CASCADE ON UPDATE CASCADE ) TYPE = innodb;and then try to create Java-Classes from this Table using the MyEclipse “Create Hibernate Mapping”-functionality, I get the following:
public class Cssrepository extends User implements java.io.Serializable { // Fields [...] private Integer owner; [...]Why does this Class extends from User??? And why is my attribute “owner” a normal “Integer” instead of a reference to an Java-Object from type “User”
Is this a bug? I have this problems since 4.1pre and I hoped that this was solved with the final version – but the problems are still the same. Am I doing something wrong?
February 5, 2006 at 8:05 pm #246142
Haris PecoMemberit is bug for any databases (probably).Can you send schema that i check ?
February 6, 2006 at 2:34 am #246150
thurisazMemberI’m quite sure that the “Create Hibernate Mapping”-Feature is currently totally unusable but I just tried it with MySQL.
If you take these SQL-Schemas
CREATE TABLE user ( userid INTEGER PRIMARY KEY, username CHAR(30), password CHAR(100) )CREATE TABLE `CssRepository` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `name` VARCHAR( 255 ) NOT NULL , `description` VARCHAR( 255 ) NOT NULL , `dateofcreation` DATETIME NOT NULL , `lastmodified` DATETIME NOT NULL , `owner` INTEGER REFERENCES User ON UPDATE CASCADE ON DELETE CASCADE ) TYPE = innodb;MySQL successfully creates a reference from Cssrepository to User, but MyEclipse doesn’t care about it
Also MyEclipse generates senseless “extends xyz”-strings (independent from any “reference”-string, I already had things like “MyClass extends MyClass”)
public class Cssrepository extends User implements java.io.Serializable { // Fields private Integer id; private String name; private String description; private Date dateofcreation; private Date lastmodified; private Integer owner; // Constructors /** default constructor */ public Cssrepository() { } /** full constructor */ public Cssrepository(String name, String description, Date dateofcreation, Date lastmodified, Integer owner) { this.name = name; this.description = description; this.dateofcreation = dateofcreation; this.lastmodified = lastmodified; this.owner = owner; } // Property accessors public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public Date getDateofcreation() { return this.dateofcreation; } public void setDateofcreation(Date dateofcreation) { this.dateofcreation = dateofcreation; } public Date getLastmodified() { return this.lastmodified; } public void setLastmodified(Date lastmodified) { this.lastmodified = lastmodified; } public Integer getOwner() { return this.owner; } public void setOwner(Integer owner) { this.owner = owner; }<hibernate-mapping> <class name="xyz.Cssrepository" table="cssrepository" catalog="csseditor"> <id name="id" type="java.lang.Integer"> <column name="id" /> <generator class="increment" /> </id> <property name="name" type="java.lang.String"> <column name="name" not-null="true" /> </property> <property name="description" type="java.lang.String"> <column name="description" not-null="true" /> </property> <property name="dateofcreation" type="java.util.Date"> <column name="dateofcreation" length="19" not-null="true" /> </property> <property name="lastmodified" type="java.util.Date"> <column name="lastmodified" length="19" not-null="true" /> </property> <property name="owner" type="java.lang.Integer"> <column name="owner" not-null="true" /> </property> </class> </hibernate-mapping>So I think there are two Bugs: first: senseless extends-expressions and second MyEclipse doesn’t take care about references… but maybe this is just a MyEclipse – MySQL- Bug?
February 7, 2006 at 3:58 am #246204
thurisazMemberare there any news yet? is it a bug or am I doing something wrong (wrong DB-drivers or anything else)?
February 7, 2006 at 4:50 am #246205
Brian FernandesModeratorThurisaz,
I apologize for the delayed response. No, you aren’t doing anything wrong, the reference issue a bug and it will be addressed in 4.1.1.
Having said that, I’m afraid I could not understand what you meant by “senseless extends-expressions”. Are you talking about
public class Cssrepository extends Useror did you mean something else?
Sorry for the inconvenience and thank you for reporting the issue.
Best,
Brian.February 7, 2006 at 5:35 am #246209
thurisazMemberThank you for your answer Brian! Well, if I create a hibernate mapping from my “User”-Table [CREATE TABLE user ( userid INTEGER PRIMARY KEY, username CHAR(30), password CHAR(100) ) ] the created class ALWAYS extends from the same class:
public class User extends User implements java.io.Serializable {
[…]
}This is just a simple example – I have this “extends”-problems with a lot of other classes too!
When will 4.1.1 be released? ‘Cause this bug creates some troubles in our roadmap.
February 7, 2006 at 5:43 am #246210
thurisazMemberCan you reproduce this bug?
February 7, 2006 at 5:47 am #246212
Brian FernandesModeratorThurisaz,
About the extends issue, on the first page of the RE wizard, there is a text box for “Base persistence class”. You probably have “User” in there, if you remove it, the generated classes won’t extend anytying (except if you chose to generate abstract classes).
I hope I’m talking about the same issue you’re facing here, let me know if it isn’t.4.1.1 is due late February, it is, for most part a maintanence and bug fix only release; and we’re trying to get it out asap.
We were able to reproduce the reference issue.
Best,
Brian.February 7, 2006 at 6:04 am #246213
thurisazMember@Support-Brian wrote:
About the extends issue, on the first page of the RE wizard, there is a text box for “Base persistence class”. You probably have “User” in there, if you remove it, the generated classes won’t extend anytying (except if you chose to generate abstract classes).
I hope I’m talking about the same issue you’re facing here, let me know if it isn’t.You’re right I thought that “Base persistent class” belongs to “Create abstract class” and I thought that the entry is ignored if I don’t want abstract classes.
Thanks this extends-problem is solved – your support in this forum is really excellent!
February 7, 2006 at 6:11 am #246214
Brian FernandesModeratorThurisaz,
Thank you for the compliment :). We will take another look at the UI of that page as it conveyed the wrong message to you.
Best regards,
Brian. -
AuthorPosts
