my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes HIBERNATE- Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "HIBERNATE- "ORTOOL"" Watch "HIBERNATE- "ORTOOL"" New topic
Author

HIBERNATE- "ORTOOL"

Mahesh Gurav
Greenhorn

Joined: Oct 18, 2004
Posts: 21
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
Ken Loh
Ranch Hand

Joined: Feb 16, 2005
Posts: 190
I think you'd get more chance of a reply in the ORM forum.
 
wood burning stoves
 
subject: HIBERNATE- "ORTOOL"
 
Similar Threads
Exception when having different class and table name
HIBERNATE- "hbm.xml" for native class as generator
Unable to find Data source
Query not in source
hibernate mapping