Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!

Lisa DeSouza

Greenhorn
+ Follow
since Jul 21, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lisa DeSouza

I have the same problem: I am trying to introduce the rupee symbol, when i do:
it displays fine
but :
does not work
where messages is a properties file and rupee=₹

however, if I used :
directly, it works.

On further investigation with Firebug, it seems the selectitem is appending a space before the text when retrieving from the properties file.

Is anyone else experiencing this problem??
8 years ago
JSF
I get this error every time I try to compile...
Caused by: org.hibernate.MappingException: Foreign key (prd_id:product [prvd_prd_id])) must have same number of columns as the referenced primary key (product_vendor_details [ven_id,prvd_vendor_id])

Can someone please explain? Thanks in advance

Vendor table and xml:
CREATE TABLE `vendor` (
`ven_id` bigint(20) NOT NULL AUTO_INCREMENT,
`ven_clinic_id` bigint(20) DEFAULT NULL,
`ven_name` varchar(20) NOT NULL,
`ven_address` varchar(100) NOT NULL,
`ven_city` varchar(30) NOT NULL,
`ven_state` varchar(30) NOT NULL,
`ven_country` varchar(30) NOT NULL,
`ven_pin` int(11) NOT NULL,
`ven_web_site` varchar(30) DEFAULT NULL,
PRIMARY KEY (`ven_id`),
KEY `FK_vendor` (`ven_clinic_id`),
CONSTRAINT `FK_vendor` FOREIGN KEY (`ven_clinic_id`) REFERENCES `client` (`clt_clinic_id`)
)


Vendor Contact table & xml:

Create Table

CREATE TABLE `vendor_contact_details` (
`vcd_id` bigint(20) NOT NULL AUTO_INCREMENT,
`vcd_vendor_id` bigint(20) DEFAULT NULL,
`vcd_title` varchar(5) DEFAULT NULL,
`vcd_name` varchar(20) DEFAULT NULL,
`vcd_phone` varchar(20) DEFAULT NULL,
`vcd_ext` int(11) DEFAULT NULL,
`vcd_remarks` varchar(100) DEFAULT NULL,
`vcd_email_id` varchar(50) DEFAULT NULL,
PRIMARY KEY (`vcd_id`)
)


Product table & xml:
CREATE TABLE `product` (
`prd_id` bigint(20) NOT NULL AUTO_INCREMENT,
`prd_clinic_id` bigint(20) DEFAULT NULL,
`prd_name` varchar(20) DEFAULT '',
`prd_description` varchar(100) DEFAULT NULL,
PRIMARY KEY (`prd_id`),
KEY `FK_product_clinic_id` (`prd_clinic_id`),
CONSTRAINT `FK_product_clinic` FOREIGN KEY (`prd_clinic_id`) REFERENCES `clinic` (`cln_id`)
)
REATE TABLE `product_vendor_details` (
`prvd_id` bigint(20) NOT NULL AUTO_INCREMENT,
`prvd_prd_id` bigint(20) NOT NULL,
`prvd_vendor_id` bigint(20) NOT NULL,
`prvd_qty` int(11) NOT NULL,
`prvd_cost_price` double NOT NULL,
`prvd_selling_price` double NOT NULL,
`prvd_weight` double NOT NULL,
`prvd_tax` double NOT NULL,
`prvd_available_qty` double NOT NULL,
`prvd_usage_type_id` bigint(20) NOT NULL,
`prvd_threshold` double NOT NULL,
`prvd_expiry_date` date NOT NULL,
`prvd_prd_unit_id` bigint(20) NOT NULL,
PRIMARY KEY (`prvd_id`),
KEY `FK_product_vendor_details_product` (`prvd_prd_id`),
KEY `FK_product_vendor_details_vendor` (`prvd_vendor_id`),
CONSTRAINT `FK_product_vendor_details_product` FOREIGN KEY (`prvd_prd_id`) REFERENCES `product` (`prd_id`),
CONSTRAINT `FK_product_vendor_details_vendor` FOREIGN KEY (`prvd_vendor_id`) REFERENCES `vendor` (`ven_id`)
)
I was struggling desperately with the same thing!!


Hope that helps!

Kelly Crotty wrote:I'm trying to use html ption to display an array of strings. I have previously used this tag to display options based on an ArrayList of objects - no problem there. But for some reason no options are getting displayed. Here is the code:
html:select multiple="true" styleClass="input" style="width:175px" size="4" styleId="emailList" property="emailList">
<html ptions property="emailList" />
</html:select>
emailList is the name of a property of the ActionForm bean.
Can anyone help with this?

10 years ago
That's what I finally ended up doing.... Thanks!

Rahul Babbar wrote:

Lisa DeSouza wrote:But is it not possible to use something equivalent to a left outer join if the entities don't contain each other as a set?



Well...there is no 'straightforward' way in hibernate to do a "Left Outer Join" when your entities do not have a relationship...

but there are hacks...

Like the following set of SQL demonstrate..



So, if it is hibernate, the above query will work....so you can get the desired result for a join even without using join .. :-)
But such a thing is not recommended, because of the performance impact that it may have if the number of joins on the table are more...and the query becomes complex...etc

But is it not possible to use something equivalent to a left outer join if the entities don't contain each other as a set?

This is my Category:


and this is my Organization:


Similar to the linking in Category I have linking for 2-3 other entities.
I actually needed to retrieve them using an HQL query equivalent to this in MYSQL:


The code you posted is equivalent to a basic join, right? and doesn't retrieve the data I need...

Edvins Reisons wrote:To use the join syntax, you need a relationship defined (I guess it is a many-to-one in this case) in the mappings. Without it, one can use a query like this:

But is it not possible to use something equivalent to a left outer join if the entities don't contain each other as a set?

Edvins Reisons wrote:To use the join syntax, you need a relationship defined (I guess it is a many-to-one in this case) in the mappings. Without it, one can use a query like this: