-->
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.  [ 1 post ] 
Author Message
 Post subject: Index on foreign keys
PostPosted: Thu Jan 10, 2008 4:40 pm 
Newbie

Joined: Wed Mar 28, 2007 7:19 pm
Posts: 2
Hi,

I am using hibernate 3 annotations

I want to add indexes on foreign keys

I have something like

@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "ANATOMY_ID")
@ForeignKey(name = "FK_W_DEVICE_ANATOMY")
@Index (name = "FK_W_DEVICE_ANATOMY") --------//THROWS ERROR
public Anatomy getAnatomy() {
return anatomy;
}

I also have

@OneToMany(cascade = CascadeType.ALL)
@Fetch(FetchMode.SUBSELECT)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@JoinColumn(name = "WIRELESS_DEVICE_ID")
@ForeignKey(name = "FK_CAMERA_W_DEV")
@Index (name = "FK_CAMERA_W_DEV") --------//THROWS ERROR
@IndexColumn(name = "DISPLAY_ORDER")
public List<Camera> getCameras() {
return cameras;
}

I get an error saying "org.hibernate.MappingException: Unable to find logical column name from physical name null in table wireless_device".

The above mappings are in a class which maps to wireless_device table.

How to add indexes on foreignkeys?

Thanks in advance!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.