-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to get method name
PostPosted: Mon Apr 16, 2007 7:33 am 
Newbie

Joined: Sun Apr 15, 2007 4:29 pm
Posts: 7
Hibernate Tools version:HibernateTools 3.2.0-beta9a

Hi all,

I am trying to write my own template for code generation by reading annotated classes. I am able to create but I just could not get the method name defined in an entity. I have a user table and a buyerrating table. rating table has two foreigns to user table.

I just need to get the method names.

for "reporterId" --> Reporter
for "reportedId" --> Reported

Does hibernate tools supply this? ( I don't know what code does hibernate tools generate I just want to get the names of these methods.)

Thanks in advance.


In BuyerRating table

@ManyToOne()
@JoinColumn(name = ("reporterId"))
public User getReporter() {
return reporter;
}

@ManyToOne()
@JoinColumn(name = ("reportedId"))
public User getReported() {
return reported;
}

In User Table

@OneToMany(cascade = CascadeType.ALL, mappedBy = "reporter")
public List<BuyerRating> getBuyerReporterList() {
return buyerReporterList;
}

public void setBuyerReporterList(List<BuyerRating> buyerReporterList) {
this.buyerReporterList = buyerReporterList;
}

@OneToMany(cascade = CascadeType.ALL, mappedBy = "reported")
public List<BuyerRating> getBuyerReportedList() {
return buyerReportedList;
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 16, 2007 9:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i'm sorry, but I don't understand what you are asking after.

What is "reporterId"; a column or a property ?

I a property then look in the existing templates pojo/*.flt on how we generated properties and methods.

What are you actually looking to generate ? sounds like you are reproducing what hbm2java already does ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.