-
1. Re: Hibernate Code Generation with Oracle
maxandersen Jul 19, 2006 2:23 PM (in response to jpremji)i don't understand the question...
-
2. Re: Hibernate Code Generation with Oracle
szgrick Jul 20, 2006 2:44 AM (in response to jpremji)I have some quesstion that i use hibernate code generation with oracle, type of INTEGER in oracle will be changed type of BigDecimal in generate coed.How to slove this quesstion.I want type of BigDecimal is int.
-
3. Re: Hibernate Code Generation with Oracle
maxandersen Jul 20, 2006 2:53 AM (in response to jpremji)that is because the INTEGER type is bigger (or at least reported to be by the driver) than a java int.
Setup your reveng.xml to map the type/column to whatever type you want. -
4. Re: Hibernate Code Generation with Oracle
jpremji Jul 20, 2006 3:30 AM (in response to jpremji)With regard to the integer, yes that was a problem and i have added the following to the reveng.xml file
<type-mapping>
<sql-type jdbc-type="DECIMAL" scale="0" hibernate-type="java.lang.Long"></sql-type>
</type-mapping> -
5. Re: Hibernate Code Generation with Oracle
jpremji Jul 20, 2006 3:33 AM (in response to jpremji)The question i am asking is if there is any way to change the reveng.xml file to include the generation of the
@SequenceGenerator(name="TABLE_ID_SEQ",sequenceName="TABLE_ID_SEQ",allocationSize=1) annotation for each table
and the
@GeneratedValue(generator="TABLE_ID_SEQ") annotation
or a template example that i can use to generate these items. -
6. Re: Hibernate Code Generation with Oracle
maxandersen Jul 20, 2006 4:12 AM (in response to jpremji)you can use reveng.xml to configure the id generator for your tables.
if that is not flexible enough for you then try and implement the logic in a custom revengstrategy impl or simply tweak the hbm.ftl templates.
Note that i'm not sure if the annotation generation does ths correctly; so we might need to fix that.
let me know if you bump into problems there. -
7. Re: Hibernate Code Generation with Oracle
jpremji Jul 20, 2006 8:01 AM (in response to jpremji)Thanks for the reponse. Is there any example of settting the reveng.xml file to generate the sequence. I am a newbie to java development. Any other pointers to information to help will be greatly appreciated.
-
8. Re: Hibernate Code Generation with Oracle
maxandersen Jul 20, 2006 8:04 AM (in response to jpremji)the docs are a good place to start :)
http://www.hibernate.org/hib_docs/tools/reference/en/html_single/
look for <generator