• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HIBERNATE- "hbm.xml" for native class as generator

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anybody knows hibernate.
HI EveryOne ,


Here is hbm.xml working ok,
buyer-table ontain email as primary key.
everything else is coming from LoginBO I USED <generator class="assigned"/>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping package="com.depo.security.loginBO">
<class name="com.depo.security.loginBO.LoginBO" table="buyer">
<meta attribute="scope-set">protected</meta>

<id name="emailID" column="email" type="java.lang.String" >
<generator class="assigned"/>
</id>
<property name="password" column="password" type="java.lang.String"/>
</class>
</hibernate-mapping>




now problem is thst primary key is buyer_id for buyer table not email ,
sir ask me to o it by using "native" method .i DIDN'T FOUND IT BUT GOT
<generator class="native"/> HOW TO IMPLEMENT IT IS WRITE WAY TO DO THIS
AS FOLLOWS ,i want to map other fields by "ASSIGNED CLASS" only buyer_id will
be generated by me & will not come fropm user PLZ have look at it.



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping package="com.depo.security.loginBO">
<class name="com.depo.security.loginBO.createBuyer" table="buyer">
<meta attribute="scope-set">protected</meta>
<id name="buyerID" column="buyer_id" type="java.lang.String">
<generator class="native"/>
</id>
</class>
<class name="com.depo.security.loginBO.LoginBO" table="buyer">
<meta attribute="scope-set">protected</meta>
<id name="buyerID" column="buyer_id" type="java.lang.String">
<generator class="asssigned"/>
</id>
<property name="emailID" column="email" type="java.lang.String" >
<property name="password" column="password" type="java.lang.String"/>
</class>
</hibernate-mapping>



IF ABOVE ONE IS CORRECT TELL HOW TO WIRITE THE CLASS,

IF WRONG ANYOTHER ALTERNATIVE???

THANKING U IN ADVANCE,
MAHESH
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic