-->
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.  [ 12 posts ] 
Author Message
 Post subject: Middlegen / JavaBean contract disconnect...
PostPosted: Wed Feb 25, 2004 9:15 pm 
Newbie

Joined: Thu Feb 19, 2004 10:25 pm
Posts: 16
Hi all, this is my 1st post to this group and I hope someone can point me in the correct direction.

In my database (which is Oracle 9i on an XPPro box) I have some tables that have column names that are prefixed by a single character then in underscore like this:

I_SECURITYID, A_FIRST_NAME, A_LAST_NAME

when I use the middlegen plugin to create the mapping files along with the stub *.java files (with the hbm2java) it create class props like this:

iSecurityId,aFirstName and aLastName

this by its self I don't think is a problem, but it also creates the accessor/mutator functions like this:

getISecurityId()
setISecurityId()
getAFirstName()
setAFirstName()
getALastName()
setALastName()

which, as i believe, do not conform to the javabean contract

this in turn will throw exceptions like this:

2004-02-25 08:39:48,506 : Configuration.add : Could not compile the mapping document
net.sf.hibernate.PropertyNotFoundException: Could not find a getter for lSecurityId in class gov.us.state.ri.doc.om.LocationPK
at net.sf.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:182)
at net.sf.hibernate.mapping.Property.getGetter(Property.java:179)
at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:882)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:286)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:973)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842)
at gov.us.state.ri.doc.infacts.struts.action.HibernateUtil.getSessionFactory(HibernateUtil.java:23)
at gov.us.state.ri.doc.infacts.struts.action.HibernateUtil.<clinit>(HibernateUtil.java:32)
at gov.us.state.ri.doc.infacts.struts.action.DisplayStyleFormAction.perform(DisplayStyleFormAction.java:50)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
<snip>

Again I believe that the function sigs. should be generated as:


getIsecurityId()
setIsecurityId()
getAfirstName()
setAfirstName()
getAlastName()
setAlastName()

or am I just all washed up?

Regards,

_________________
-Scott-


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 6:48 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This may be a bug in middlegen
http://www.hibernate.org/116.html#A30

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 7:43 am 
Newbie

Joined: Thu Feb 19, 2004 10:25 pm
Posts: 16
emmanuel wrote:
This may be a bug in middlegen
http://www.hibernate.org/116.html#A30


Yes and No, I beleave its a bug in the hibernate plugin for middlegen. It is incorrectly interpeting setter/getter names for calss properties in which the second charactor in the name is in upper case. I'd like to fix it myself and summit a patch, but I can not determin the name of the module in CVS on sf.net to check out the plugin. Do you know what it is?

Thanks,

_________________
-Scott-


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 8:46 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
http://cvs.sourceforge.net/viewcvs.py/middlegen/middlegen/plugins/hibernate/

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Dohhh!
PostPosted: Thu Feb 26, 2004 9:47 am 
Newbie

Joined: Thu Feb 19, 2004 10:25 pm
Posts: 16
emmanuel wrote:


...no wounder I couldn't find it, I was looking for in the Hibernate source... Thanks, but after a quick look at I think I may be in the wrong place after all. But I'll keep looking. Any suggestions?

-Scott-

_________________
-Scott-


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 11:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
This is a known issue with Middlegen Core (not the plugin). I will get around to it but your welcome to submit a patch against the lastest CVS. Check out dbNameConverter if your interested.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 28, 2004 1:43 pm 
Newbie

Joined: Thu Feb 19, 2004 10:25 pm
Posts: 16
david wrote:
This is a known issue with Middlegen Core (not the plugin). I will get around to it but your welcome to submit a patch against the lastest CVS. Check out dbNameConverter if your interested.


Cool! I'll go checkout the source and give a try. Where would I send the patch?

_________________
-Scott-


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 28, 2004 8:33 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
send it to me, eg, david@hibernate.org


Top
 Profile  
 
 Post subject: DbNameConverter patch
PostPosted: Mon Mar 01, 2004 7:23 pm 
Newbie

Joined: Thu Feb 19, 2004 10:25 pm
Posts: 16
david wrote:
send it to me, eg, david@hibernate.org


I e-mailed you a patch that fixes this bug and not sure if you got it so I'm posting it here also:

http://www.thecityside.com:8080/mvnforum/mvnforum/viewthread?thread=30&offset=0

if someone could commit it it would be nice.

TIA,

_________________
-Scott-


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2004 3:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I have check it and commit it to CVS.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2004 9:00 am 
Newbie

Joined: Thu Feb 19, 2004 10:25 pm
Posts: 16
david wrote:
I have check it and commit it to CVS.


Cool! Thanks.

_________________
-Scott-


Top
 Profile  
 
 Post subject: Re: Middlegen / JavaBean contract disconnect...
PostPosted: Sun Dec 23, 2012 8:59 pm 
Newbie

Joined: Thu Dec 20, 2012 11:11 pm
Posts: 6
Is there a way to ignore the foreign keys of all tables from my database ?


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