| [ Teneo ] USE_MAPPING_FILE minor enhancement [message #89043] | 
Wed, 11 July 2007 14:29   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi All, 
 
I ran into some small trouble getting 
        teneoProps.setProperty(PersistenceOptions.USE_MAPPING_FILE, "true"); 
to work.  I had a mapping file in the root directory and it looked like it 
was working, but when I changed the mapping file, the changes wouldn't show 
up. 
 
It turns out that the code that looks for the mapping file looks for the 
resource in ";hibernate.hbm.xml" which it doesn't find.  It then just builds 
its own hbm from the available code and seems like it worked even though it 
actually didn't.  I fixed it by adding code to StoreUtil.java like this: 
 
    //--- JJH support for userSpecifiedHBMFile 
    private static String userSpecifiedHBMFile; 
    public static String getSpecificMappingFile() 
    { 
        return userSpecifiedHBMFile; 
    } 
 
    public static void setSpecificMappingFile(String val) 
    { 
        userSpecifiedHBMFile=val; 
    } 
    //--- JJH 
 
Then in StoreUtil.getFileList() I added: 
 
    //--- JJH: Want to specify a teneo generated mapping file that isn't 
named hibernate.hbm.xml 
    if(null != getSpecificMappingFile()){ 
        result.add(getSpecificMappingFile()); 
    } 
    //--- JJH 
    return result.toArray(new String[result.size()]); 
 
 
This should really go into Properties, but I didn't want to make property 
names without your involvement since the documentation has to be updated and 
what not.  But the idea is helpful because I can specify exactly which hbm 
file to use.  (I have a different hbm for each project and I prefer to not 
have them all named the same thing, even if they are in different projects) 
 
If you give me a property name to use, I'll make this code nicer, put it 
into a Property and submit it. 
 
Thanks! 
 
                 Jason Henriksen
 |  
 |  
  | 
| Re: [ Teneo ] USE_MAPPING_FILE minor enhancement [message #89059 is a reply to message #89043] | 
Wed, 11 July 2007 14:37   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi Jason, 
I think this propertyname would work: 
	public static final String HIBERNATe_MAPPING_FILE_NAME = MAPPING_PREFIX +  
"hibernate_mapping_file_name"; 
 
It would be great if you can submit a patch for this, thanks! 
 
gr. Martin 
 
Jason Henriksen wrote: 
> Hi All, 
>  
> I ran into some small trouble getting 
>         teneoProps.setProperty(PersistenceOptions.USE_MAPPING_FILE, "true"); 
> to work.  I had a mapping file in the root directory and it looked like it 
> was working, but when I changed the mapping file, the changes wouldn't show 
> up. 
>  
> It turns out that the code that looks for the mapping file looks for the 
> resource in ";hibernate.hbm.xml" which it doesn't find.  It then just builds 
> its own hbm from the available code and seems like it worked even though it 
> actually didn't.  I fixed it by adding code to StoreUtil.java like this: 
>  
>     //--- JJH support for userSpecifiedHBMFile 
>     private static String userSpecifiedHBMFile; 
>     public static String getSpecificMappingFile() 
>     { 
>         return userSpecifiedHBMFile; 
>     } 
>  
>     public static void setSpecificMappingFile(String val) 
>     { 
>         userSpecifiedHBMFile=val; 
>     } 
>     //--- JJH 
>  
> Then in StoreUtil.getFileList() I added: 
>  
>     //--- JJH: Want to specify a teneo generated mapping file that isn't 
> named hibernate.hbm.xml 
>     if(null != getSpecificMappingFile()){ 
>         result.add(getSpecificMappingFile()); 
>     } 
>     //--- JJH 
>     return result.toArray(new String[result.size()]); 
>  
>  
> This should really go into Properties, but I didn't want to make property 
> names without your involvement since the documentation has to be updated and 
> what not.  But the idea is helpful because I can specify exactly which hbm 
> file to use.  (I have a different hbm for each project and I prefer to not 
> have them all named the same thing, even if they are in different projects) 
>  
> If you give me a property name to use, I'll make this code nicer, put it 
> into a Property and submit it. 
>  
> Thanks! 
>  
>                  Jason Henriksen 
>  
>  
 
 
--  
 
With Regards, Martin Taal 
 
Springsite/Elver.org 
Office: Hardwareweg 4, 3821 BV Amersfoort 
Postal: Nassaulaan 7, 3941 EC Doorn 
The Netherlands 
Tel: +31 (0)84 420 2397 
Fax: +31 (0)84 225 9307 
Mail: mtaal@springsite.com - mtaal@elver.org 
Web: www.springsite.com - www.elver.org
 |  
 |  
  | 
| Re: [ Teneo ] USE_MAPPING_FILE minor enhancement [message #608701 is a reply to message #89043] | 
Wed, 11 July 2007 14:37   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi Jason, 
I think this propertyname would work: 
	public static final String HIBERNATe_MAPPING_FILE_NAME = MAPPING_PREFIX +  
"hibernate_mapping_file_name"; 
 
It would be great if you can submit a patch for this, thanks! 
 
gr. Martin 
 
Jason Henriksen wrote: 
> Hi All, 
>  
> I ran into some small trouble getting 
>         teneoProps.setProperty(PersistenceOptions.USE_MAPPING_FILE, "true"); 
> to work.  I had a mapping file in the root directory and it looked like it 
> was working, but when I changed the mapping file, the changes wouldn't show 
> up. 
>  
> It turns out that the code that looks for the mapping file looks for the 
> resource in ";hibernate.hbm.xml" which it doesn't find.  It then just builds 
> its own hbm from the available code and seems like it worked even though it 
> actually didn't.  I fixed it by adding code to StoreUtil.java like this: 
>  
>     //--- JJH support for userSpecifiedHBMFile 
>     private static String userSpecifiedHBMFile; 
>     public static String getSpecificMappingFile() 
>     { 
>         return userSpecifiedHBMFile; 
>     } 
>  
>     public static void setSpecificMappingFile(String val) 
>     { 
>         userSpecifiedHBMFile=val; 
>     } 
>     //--- JJH 
>  
> Then in StoreUtil.getFileList() I added: 
>  
>     //--- JJH: Want to specify a teneo generated mapping file that isn't 
> named hibernate.hbm.xml 
>     if(null != getSpecificMappingFile()){ 
>         result.add(getSpecificMappingFile()); 
>     } 
>     //--- JJH 
>     return result.toArray(new String[result.size()]); 
>  
>  
> This should really go into Properties, but I didn't want to make property 
> names without your involvement since the documentation has to be updated and 
> what not.  But the idea is helpful because I can specify exactly which hbm 
> file to use.  (I have a different hbm for each project and I prefer to not 
> have them all named the same thing, even if they are in different projects) 
>  
> If you give me a property name to use, I'll make this code nicer, put it 
> into a Property and submit it. 
>  
> Thanks! 
>  
>                  Jason Henriksen 
>  
>  
 
 
--  
 
With Regards, Martin Taal 
 
Springsite/Elver.org 
Office: Hardwareweg 4, 3821 BV Amersfoort 
Postal: Nassaulaan 7, 3941 EC Doorn 
The Netherlands 
Tel: +31 (0)84 420 2397 
Fax: +31 (0)84 225 9307 
Mail: mtaal@springsite.com - mtaal@elver.org 
Web: www.springsite.com - www.elver.org
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.03979 seconds