Using NH 2.0, I have a custom type. It is composed of four properties,
so I implemented ICompositeUserType.
I want to specify length and precision for the string and decimal properties within the user type, to avoid specifying it with every usage in the mapping files.
But there is only a PropertyTypes property to implement, which retu...
Does anyone have a good approach towards unit testing their UserTypes?
By way of example, I have an object in my model called DateRange, which has a DatePoint start and DatePoint end. In addition to making range type operations available for two DateTimes, these objects let me adjust the precision for the task at hand (i.e., Day, Hour, ...
New to NHibernate and learning it as we are modifying an existing solution to use this ORM.
Ideally, the storage structure and object classes need to stay the same, so Ive come across one or two mapping problems.
One class 'Money' has a value and currency. The value is a double and the currency is a foreign key to a list table of curren...
In legacy database tables we have numbered columns like C1, C2, C3, C100 or M1, M2, M3, M100.
This columns represent BLOB data.
It is not possible to change anything it this database.
By using JPA Embeddable we map all of the columns to single fields. And then during embedding we override names by using 100 override annotations.
Recen...
I would like to have Visual Studio highlight the names of my own classes in the text editor.
I have selected a color under User Types in Options > Fonts & Colors -- but strangely, this only works for Visual C# but not Visual C++.
Any ideas what's going on?
EDIT: I received some great tips regarding 3rd party tools in response to my pr...
I've created a UserType (see below) to handle a situation in our mySQL database where we've been saving null dates as 0000-00-00 00:00:00.
When I try and persist my entity with a null for dispDT (see below) it generates this exception: "javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property refer...
When i map columns from the inspected table, i do this:
<property name="InstanceName" type="MyNameUserType, MyApp.MyNamespace">
<column name="Name"/>
<column name="Name2"/>
</property>
How can I make property mapping initialize a UserType with data retrieved by the formula's sql query?
<property name="InstanceName" type="MyName...
I needed a way to trim strings within my persistent class because my legacy database is using char fields. I downloaded the nHhaddIns dll to use its TrimString class which is derived from IUserType.
Using their example I created a property in my mapping class as shown at the bottom.
uNHAddIns is added as a project within my solution. H...
Hey,
working with JPA above hibernate impl.
I map my enums by using user-type follow the good practice to store a persistence key to the enum and not the ordinal (which can be changed).
Now, i have a problem to query on the enum field. it seems that hibernate dont execute the user type convert on the name-query.
Any idea?
...
It's possible to use @TypeDefs annotation to define short type name for a UserType. But how to define it for entire application?
...
Hi.
I'm using a UserType to maintain a column (Created) in my db.
When saving to db i simply check if the property in question equals DateTime.MinValue, and if so updates it to DateTime.Now (overriding NullSafeSet). This update however, is not immediately reflected by nhibernate, and if i load the object again without evicting it, th...
I am looking to persist user preferences into a collection of name value pairs, where the value may be an int, bool, or string.
There are a few ways to skin this cat, but the most convenient method I can think of is something like this:
public class User
{
public virtual IDictionary<string, object> Preferences { get; set; }
}
wit...
I am trying to map a normalized Java model to a legacy database schema using Hibernate 3.5. One particular table encodes a foreign keys in a one-to-many relationship as a bit array column.
Consider tables person and club that describes people's affiliations to clubs:
person: .----.------. club: .----.---------.----------------------...
I have several different UserType's (org.hibernate.usertype.UserType) in the system. For this question I will focus on the fact that we use Joda time DateTime and its UserType, PersistentDateTime.
I have successfully bound the UserType programmatically to PersistentClass's by:
public void customize(Ejb3Configuration config) {
Iterato...
I have two types of users on my site:
Normal user
Supplier
How do I set up Drupal so that you can choose which type of user you want to be before signing up, and then also (and this is the tricky part) give different profile fields to the different user types?
...
I found that if you create a file called "usertype.dat" in visual studio's IDE dir, that you can specify keywords that will appear in blue like "new" or "int".
Is there a way to assign values to these?
I don't want to have to use "#define [keyword] [value]" in every single file that I use..
Specifically, I would like to have a "null = ...
Hello,
I am wondering if is possible to implement following domain model.
Let's have a domain class which contains set of intervals (joda time). I can use org.joda.time.contrib.hibernate.PersistentInterval hibernate user type for mapping of Interval to database table (by similar way as in http://www.grails.org/JodaTime+Plugin). However...