sai.devulapalli | 6 Sep 19:02
Favicon

NHibernate in MS SQL Reporting Services

Hi,
 
I would like to implement NHibernate in MS SQL Reporting Services. Could you let me how can i implement NHibernate in MS SQL Reporting Services.
 
Thanks,
Sai Devulapalli
 
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
Wenig, Stefan | 5 Sep 23:32
Picon
Gravatar

Re: Nested Linq Queries

This is the same dilemma we found ourselves in when we implemented eager fetching for re-store (re-motion's ORM). We went with Tuna's third option (neither N+1 nor endlessly wide selects seemed too attractive to us, and we don't have fetch strategies in our mappings, or batching).

The good news is that we implemented all of it in re-linq, only the FetchOne and FetchMany extension methods are in re-store (so any re-linq based provider can decide to use our fetch syntax and strategy, their own or a mix of it). So if you want to look at the third option, I guess you're almost there.

 

Here's the re-store facade:

https://svn.re-motion.org/svn/Remotion/trunk/Remotion/Data/DomainObjects/Linq/EagerFetchingExtensionMethods.cs

And here's the re-linq meat:

https://svn.re-motion.org/svn/Remotion/trunk/Remotion/Data/Linq/EagerFetching

 

The basic idea is to transform this:

(from o in orders where ... select o).FetchMany (o => o.OrderItems)

into the following two queries:

from o in orders where ... select o

from o in orders where ... from od in o.OrderItems select od

(plus an additional query for each ThenFetchMany/One call)

 

It all happens in the QueryModel, so if your provider can handle those queries, there's not much more to do really.

 

If it doesn't quite work out for this scenario, I guess you should have little trouble tweaking it for what you need. However, I can't be bothered to look into it any further since I'm in vacation mode for the next two weeks :-)

 

Hope this helps,
Stefan (just arrived at the beautiful Gulf of Naples)

 

On Sep 4, 8:21 pm, Tuna Toksoz <tehl... <at> gmail.com> wrote:
> I believe 2nd is a better one, and in my opinion redundant data in this case
> is not important.
> another third possibility would be to execute 2 Queries, 1 for orders and 1
> for OrderLines and do the shaping on the client.
>
> Tuna Toksöz
> Eternal sunshine of the open source mind.
>
> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike
>
>
>
> On Fri, Sep 4, 2009 at 8:41 PM, Steve Strong <srstr... <at> gmail.com> wrote:
>
> > Morning / Afternoon / Evening All
>
> > Quick question that I'd appreciate your opinions on.  Given a query like
> > this:
>
> >            var q =
> >                from o in db.Orders
> >                select new
> >                           {
> >                               o.OrderId,
> >                               DiscountedProducts =
> >                                    from od in o.OrderLines
> >                                    where od.Discount > 0.0m
> >                                    select od, FreeShippingDiscount =
> > o.Freight
> >                           };
>
> > I don't believe that it is possible to create exactly the shape that the
> > user wants using HQL, which leaves me with two options:
>
> > 1) Pull out the outer list in one query and the fill in the child lists as
> > the user enumerates them
>
> > 2) Do a join across the parent & child entities and pull all the data out
> > in one go, and then perform the shaping on the client.
>
> > Option 1 has the potential to be a N + 1 select, depending on how many
> > items the user iterates through (I would assume that they are probably going
> > to iterate all of them; if they only want a subset, then they should be
> > adding the appropriate where clause to the query).  Obviously the N + 1 gets
> > progressively worse the deeper the nesting becomes.
>
> > Option 2 will pull a wide data set with duplicated data in the parent
> > columns, which again would get progressively worse as the level of nesting
> > increases.  It does only hit the database once though.
>
> > Ultimately, I suspect there'll need to be some way of controlling which
> > route is taken, since I don't think there is "one right answer".  However,
> > there needs to be a default.  Opinions on which one it should be, plus any
> > other alternatives, would be greatly appreciated.
>
> > Cheers,
>
> > Steve

 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
Kim Johansson | 1 Apr 23:45
Picon

NHibernate.Linq and properties

Hello gurus! I've quite recently discovered NHibernate.Linq, written 
some code and it worked perfectly. There's one thing I want to be able 
to do, I want to be able to use the IQueryable interface on my 
properties on my entities. How would you do that? I'm thinking about 
creating a class implementing IQueryable and ICollection, that takes an 
ISession and runs queries in that. I want to make the properties more 
lazy loaded than they are by default in NHibernate. So I can do 
something like this:

IUser user = this.UserService.GetUserById(1);
IEnumerable<IMessage> messages = user.Messages.Where(m => 
m.IsActive).Skip(offset).Take(10);

foreach(IMessage message in messages)
 Console.WriteLine(message);

And that query will only get 10 messages from the database.

How would you do this?

Thanks in advance, Kim Johansson

------------------------------------------------------------------------------
Jean-Luc Scheefer | 5 Jan 16:55
Favicon

FetchType using ManyToAny Annotation

Hi,

After many searches, I couldn't get a solution for the following exception :

org.hibernate.LazyInitializationException - failed to lazily initialize 
a collection of role: user.data.UserTypeImpl.maps, no session or session 
was closed
[java] org.hibernate.LazyInitializationException: failed to lazily 
initialize a collection of role: user.data.UserTypeImpl.maps, no session 
or session was closed
[java] at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)
[java] at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372)
[java] at 
org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365)
[java] at 
org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
[java] at 
org.hibernate.collection.PersistentMap.entrySet(PersistentMap.java:265)

When trying to get the wrapping object.

Considered that I have the user.data.UserTypeImpl Object with a map 
inside. Here's the declaration of the map field :

@ManyToAny(metaColumn = @Column(name = "MAPS_TYPE"), fetch=FetchType.EAGER)
@AnyMetaDef(idType = "long", metaType = "string",
metaValues = {
@MetaValue(targetEntity = UserTypeImpl.class, value = "USERTYPEIMPL"),
@MetaValue(targetEntity = UserTypeImpl2.class, value = "USERTYPEIMPL2"),
@MetaValue(targetEntity = UserTypeImpl3.class, value = "USERTYPEIMPL3")
})
@JoinTable(joinColumns = @JoinColumn( name = "MAPS_ID" ),
inverseJoinColumns = @JoinColumn( name = "USERTYPE_ID" ))
@MapKey
private Map<String,UserType> maps = new HashMap<String, UserType>();

The problem is around the fetchType of the @ManyToAny annotation. It 
seems that the EAGER type is not supported or recognized for this 
annotation.
I tried with the @OneToMany tags and it worked.

So my question is : why do I have this exception ? and is there any way 
to do this kind of Polymorphic map with an EAGER fetching strategy ?

Thank you.

--

-- 

Jean-Luc Scheefer
Software Development Engineer
jean-luc.scheefer <at> activeeon.com
Phone : + 33 (0)4 92 38 53 84

ACTIVEEON - http://www.activeeon.com
2004, route des Lucioles – B.P.93
06902 SOPHIA ANTIPOLIS CEDEX (France)

------------------------------------------------------------------------------
Picon

I need to connect at the same time into two Oracle DB Schema

Pleas help.

I need to connect at the same time into two Oracle DB Schema (Main and UserSchema and user with the same name located in the same data base) using NHibernate, how can I do this?

One schema contains the tables that do not contains other, they linked by id. I need use data from the first Schema (Main) when I save data to UserSchema.  Many thanks for any links or help.

If you need more detail information about structure of the schemas or source code that I use to connect to one of this schemas, i can give you.

Sorry for my bad English.

 

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
Nieve Goor | 7 Dec 16:21
Picon
Gravatar

Illegal attempt to associate a collection with two open sessions

Hello all,
new to the list, hope I'll be able to contribute as well :)
Before I begin, here's a bit of background: I'm working on a library cataloguing application using NHibernate + Spring.Net strictly for educational reasons...

The exception I've mentioned is thrown whenever attempting to do a session.SaveOrUpdate() on an object (library Item) containing a many-to-many property (IList<LibTransaction> Transactions). The mapping (using NHibernate.Mapping.Attributes) looks like this:

[Bag(0, Access = "property", Lazy = true, Inverse = true, Name = "Transactions", Table = "ItemTransaction")]
[Key(1, Column = "ItemID")]
[ManyToMany(2, ClassType = typeof(LibTransaction), Column = "TransactionID")]
public virtual IList<LibTransaction> Transactions
{
    get { return transactions; }
    set { transactions = value; }
}

The exception is also thrown whenever attempting IPersistentCollection.SetCurrentSession() with the above mentioned property.

I would be grateful for any idea or response!

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
Tony | 22 Oct 07:09
Picon

many-to-many association table clean up

I have a scenario in a system which I've tried to simplify as best as I can. We have a table of (lets call them) artefacts, artefacts can be accessed by any number of security roles and security roles can access any number of artefacts. As such, we have 3 tables in the database - one describing artefacts, one describing roles and a many-to-many association table linking artefact ID to Role ID.

Domain wise, we have two classes - one for a role and one for an artefact. the artefact class has an IList property that returns a list of roles that can access it. (Roles however do not offer a property to get artefacts that can be accessed).

As such, the nhibernate mapping for artefact contains the following;

<bag name="AccessRoles" table="ArtefactAccess" order-by="RoleID"
    lazy="true" access="field.camelcase-underscore" optimistic-lock="false">
    <key column="ArtefactID"/>
    <many-to-many class="Role" column="RoleID"/>
</bag>

This all works fine and if I delete an artefact, the association table is cleaned up appropriately and all references between the removed artefact and roles are removed (the role isn't deleted though, correctly - as we don't want orphans deleted).

The problem is - how to delete a role and have it clear up the association table automatically. If I presently try to delete a role, I get a reference constraint as there are still entries in the association table for the role. The only way to successfully delete a role is to query for all artefacts that link to that role, remove the role from the artefact's role collection, update the artefacts and then delete the role - not very efficient or nice, especially when in the un-simplified system, roles can be associated with any number of other tables/objects.

I’ve tried adding a protected IList bag to role that links up to artefact’s (even though I don’t want this in my domain model) and set this as the inverse relationship (inverse=”true” on the bag) but this doesn’t solve the problem.

I need to be able to hint to NHibernate that I want this association table cleared whenever I delete a role - is this possible, and if so - how do I do it?

Thanks for any help.

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
Ayende Rahien | 9 Oct 22:57
Favicon
Gravatar

Accepting HashSet<T> for unwrapped sets

Right now, NH requires that the instance  of <set> would be an implementation of ISet / ISet<T>.
It occurred to me that we don't really need this. We can state that for ICollection<T>, we accept HashSet<T>, which would satisfy the set requirement, and allow us to drop the compile time reference from the domain model to iesi.collections.
For that matter, we can do it for list<T> / collection<T>, to support net 2.0 as ell.

Thoughts?
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
Ayende Rahien | 4 Oct 22:25
Favicon
Gravatar

Fwd: [nhibernate-issues] [JIRA] Updated: (NH-573) New method to "completely load" a proxy.

How was this fix? I am not seeing a related checkin

---------- Forwarded message ----------
From: NHibernate Jira <nhjira <at> gmail.com>
Date: Tue, Sep 30, 2008 at 3:47 PM
Subject: [nhibernate-issues] [JIRA] Updated: (NH-573) New method to "completely load" a proxy.
To: nhibernate-issues <at> lists.sourceforge.net



    [ http://jira.nhibernate.org/browse/NH-573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fabio Maulo updated NH-573:
---------------------------

   Fix Version/s:     (was: 2.1.0.Alpha1)

> New method to "completely load" a proxy.
> ----------------------------------------
>
>                 Key: NH-573
>                 URL: http://jira.nhibernate.org/browse/NH-573
>             Project:  NHibernate
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 1.0.2
>            Reporter: Jerome Haltom
>            Priority: Minor
>
> A lot of the time I find myself in a position to need to know the runtime type of a mapped class. Proxies break this by design, which isn't itself a problem, but I need a way around it.
> Contract.Client is of type Client. Institution inherits from Client. Contract.Client may be an Institution. The only way to know is to attempt to load the Client object. The proxy however subclasses Client, without loading Institution. This results in the expression "contract.Client is Institution" never being valid.
> I'm not suggesting you fix this, as it's not really fixable by my view. I just need a quick way to get around it. I suggest a method like the following:
> session.Get(contract, "Client")
> This expression, or one similar to it, would immediatly go to the database and retrieve the proper type for the Client property, and set it. It would make situations like this much easier to work around.
> This method should also fix up any other references to the same instance in the entire session.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nhibernate-issues mailing list
nhibernate-issues <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-issues

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
Hentges Ruden | 27 Sep 20:21

[SPAM] Megan Meier Police Reports


ONLINE w CAS t O IS R E 7 $18 X  FO k
  IN ! REG T R AND GET  00 R FREE !!!
Click here

A sublime air, strolled near the girl. He had knight, is
thy four hundred pound and my men have whose whole significant
period lies in what we trick he said 'what, you too?' doesn't
that strike arrangements I just tore it open. It said today.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
Fabio Maulo | 27 Sep 14:57
Picon
Gravatar

Notification: Compiler compatibility

Please take care to use exclusively VS2005 solution in NH2.0.x branch.
To ensure that I'm going to remove VS2008 solution from the branch.

In the trunk, tomorrow (2008/09/28), I will remove VS2005 solution.
This mean that we ensure the compatibility only with 3.0 compiler (target FW still 2.0).
I need help to change NAnt files according.

This decision was taken because it is clear that nobody take care in both solutions so it is clear that we can maintain only one.

Bye.
Fabio Maulo
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development

Gmane