You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ben Munat <be...@munat.com> on 2006/05/26 22:16:14 UTC
import/include configs
Is there any way to import or include extra sqlMapConfig information into a
sql-map-config.xml file? I have different maps that I want to tell ibatis about depending
on which client I'm building the app for.
I suppose I could probably do some ant build trickery, but I wanted to make sure that I
wasn't missing some ibatis feature that would allow me to do this cleanly. In fact, if the
sqlMap "resource" attribute allowed wild cards or if there was some way to conditionally
load the resource, that would be enough.
b
Re: Enum Type
Posted by Nathan Maves <Na...@Sun.COM>.
Levan,
As a first time poster let me inform you on a great source of
information. Below is the archive of this alias. Please search
there before posting new questions.
http://www.mail-archive.com/user-java@ibatis.apache.org/
To answer your post...
Yes, This is fully supported in ibatis. You will need to create a
CTH(custom type handler). There is a wiki post about this.
http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I
+use+a+Custom+Type+Handler+with+complex+property+or+Type+Safe
+Enumeration
On a side note I would not suggest naming you enums like that. Other
people might get them confused with a method name. I would suggest
FULL CAPS for enum names. Just a good convention :)
Nathan
On May 29, 2006, at 11:20 AM, levan Dvalishvili wrote:
> Hi All!
> I am need to this mailing ,a s a fact this is my first question
> here ..
>
> I am working on a project and would like to use ENUM as an
> attribute on my
> bean like this :
>
> ------------------ SAMPLE CODE ------------------------
> public class Shipment implements Serializable{
> enum ShipmentStatus{notShipped("Not Shiped"),
> onTheWay("on the way"),
> arrived("Arrived");
>
> private String value;
>
> ShipmentStatus(String newValue) {
> value = newValue;
> }
>
>
> ShipmentStatus() {
> value="NOT SPECIFIED";
> }
> String getShipmentStatus() { return value; }
> }
>
> private ShipmentStatus Status;
> private Date departureDate;
> private ShipmentStatus Status;
> private Date ArivalDate;
> etc .....
> }
> ---------------------- END OF SAMPLE CODE
> --------------------------------
>
> I am working into IBATIS as I go ..., and would like to ask if this
> way will
> work with the mapping? Do I have to write a custom type handler?
> I also have ac corresponding enum on database side (DB is mySQL) Has
> anything like that been done yet? Is this a right way of doing it
> or should
> I just forget about ENUM and just use string?
> Best regards
> And thanks for creating such a great product
> Levan.
>
>
>
Enum Type
Posted by levan Dvalishvili <ad...@amostudio.com>.
Hi All!
I am need to this mailing ,a s a fact this is my first question here ..
I am working on a project and would like to use ENUM as an attribute on my
bean like this :
------------------ SAMPLE CODE ------------------------
public class Shipment implements Serializable{
enum ShipmentStatus{notShipped("Not Shiped"),
onTheWay("on the way"),
arrived("Arrived");
private String value;
ShipmentStatus(String newValue) {
value = newValue;
}
ShipmentStatus() {
value="NOT SPECIFIED";
}
String getShipmentStatus() { return value; }
}
private ShipmentStatus Status;
private Date departureDate;
private ShipmentStatus Status;
private Date ArivalDate;
etc .....
}
---------------------- END OF SAMPLE CODE --------------------------------
I am working into IBATIS as I go ..., and would like to ask if this way will
work with the mapping? Do I have to write a custom type handler?
I also have ac corresponding enum on database side (DB is mySQL) Has
anything like that been done yet? Is this a right way of doing it or should
I just forget about ENUM and just use string?
Best regards
And thanks for creating such a great product
Levan.
Re: import/include configs
Posted by Larry Meadors <lm...@apache.org>.
I think you are going to have to stick with ant trickery for now.
Larry
On 5/26/06, Ben Munat <be...@munat.com> wrote:
> Is there any way to import or include extra sqlMapConfig information into a
> sql-map-config.xml file? I have different maps that I want to tell ibatis about depending
> on which client I'm building the app for.
>
> I suppose I could probably do some ant build trickery, but I wanted to make sure that I
> wasn't missing some ibatis feature that would allow me to do this cleanly. In fact, if the
> sqlMap "resource" attribute allowed wild cards or if there was some way to conditionally
> load the resource, that would be enough.
>
> b
>