-->
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: help with mapping file: formula sql use.
PostPosted: Wed Aug 09, 2006 6:51 am 
Newbie

Joined: Wed Aug 09, 2006 6:36 am
Posts: 1
Hey, I've got a problem I can't find help on in the manual or the internet at large. I have some idea of how to do it, but I'm really not sure about it.

What I need to do: I have a few columns in the database I'm using that correspond to file formats. They come in pairs for each format, one was a path for that format and another for the size of that format. (In relation to the current row.) If they're null, that means the row I'm looking at doesn't come in that format and that I shouldn't create a new file format object and add it to a collection of formats for that row's object.

Now I'm quite happy to write a custom user type for the class I'm going to have to instantiate to encapsulate the file format information, and I think mapping them as a collection is well documented so I think that should be okay too.

It's just I'm not sure how to put in the mapping file: "if these columns are null, don't make an object, if they aren't make an object and add it to this collection." I thought it could maybe be done with formulas... or the column check="SQL expression" attribute. But I'm not sure how to get them to cancel the creation of a new object if they return false rather than just cause exceptions.

Any help would be greatly appreciated!

Thanks

Meghan

info if you need it:

Hibernate version: 3.1.3

Mapping documents:

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

<hibernate-mapping>

<class name="edina.util.product.impl.TileImpl" table="COVERAGES" mutable="false">
<cache usage="read-only"/>

<composite-id>
<key-property name="name" type="string" column="TILE"/>
<key-property name="product"/>
</composite-id>

<property name="name" type="string" column="TILE" insert="false" update="false" />
<property name="product" type="string" column="PRODUCT"/>

<property name="amended" type="date" column="AMENDED_DATE"/>
<property name="bbox" type="edina.util.geometry.BoundingBoxUserType">
<column name="MINX" sql-type="integer" not-null="true"/>
<column name="MAXX" sql-type="integer" not-null="true"/>
<column name="MINY" sql-type="integer" not-null="true"/>
<column name="MAXY" sql-type="integer" not-null="true"/>
</property>
</class>

</hibernate-mapping>

Name and version of the database you are using: INGRES


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.