Search Results

Search found 4565 results on 183 pages for 'nhibernate mapping'.

Page 63/183 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • Update mapping table in Linq

    - by Gary McGill
    I have a table Customers with a CustomerId field, and a table of Publications with a PublicationId field. Finally, I have a mapping table CustomersPublications that records which publications a customer can access - it has two fields: CustomerId field PublicationId. For a given customer, I want to update the CustomersPublications table based on a list of publication ids. I want to remove records in CustomersPublications where the PublicationId is not in the list, and add new records where the PublicationId is in the list but not already in the table. This would be easy in SQL, but I can't figure out how to do it in Linq. For the delete part, I tried: var recordsToDelete = dataContext.CustomersPublications.Where ( cp => (cp.CustomerId == customerId) && ! publicationIds.Contains(cp.PublicationId) ); dataContext.CustomersPublications.DeleteAllOnSubmit(recordsToDelete); ... but that didn't work. I got an error: System.NotSupportedException: Method 'Boolean Contains(Int32)' has no supported translation to SQL So, I tried using Any(), as follows: var recordsToDelete = dataContext.CustomersPublications.Where ( cp => (cp.CustomerId == customerId) && ! publicationIds.Any(p => p == cp.PublicationId) ); ... and this just gives me another error: System.NotSupportedException: Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator Any pointers? [I have to say, I find Linq baffling (and frustrating) for all but the simplest queries. Better error messages would help!]

    Read the article

  • How to configure database connection securely

    - by chiccodoro
    Similar but not the same: How to securely store database connection details Securely connecting to database within a application Hi all, I have a C# WinForms application connecting to a database server. The database connection string, including a generic user/pass, is placed in a NHibernate configuration file, which lies in the same directory as the exe file. Now I have this issue: The user that runs the application should not get to know the username/password of the general database user because I don't want him to rummage around in the database directly. Alternatively I could hardcode the connection string, which is bad because the administrator must be able to change it if the database is moved or if he wants to switch between dev/test/prod environments. So long I've found three possibilities: The first referenced question was generally answered by making the file only readable for the user that runs the application. But that's not not enough in my case (the user running the application is a person. The database user/pass are general and shouldn't even be accessible by the person.) The first answer additionally proposed to encrypt the connection data before writing it to the file. With this approach, the administrator is not able anymore to configure the connection string because he cannot encrypt it by hand. The second referenced question provides an approach for this very scenario but it seems very complicated. My questions to you: This is a very general issue, so isn't there any general "how-to-do-it" way, somehow a "design pattern"? Is there some support in .NET's config infrastructure? (optional, maybe out of scope) Can I combine that easily with the NHibernate configuration mechanism?

    Read the article

  • Hibernate Bi- Directional many to many mapping advice!

    - by Rob
    hi all, i woundered if anyone might be able to help me out. I am trying to work out what to google for (or any other ideas!!) basically i have a bidirectional many to many mapping between a user entity and a club entity (via a join table called userClubs) I now want to include a column in userClubs that represents the role so that when i call user.getClubs() I can also work out what level access they have. Is there a clever way to do this using hibernate or do i need to rethink the database structure? Thank you for any help (or just for reading this far!!) the user.hbm.xml looks a bit like <set name="clubs" table="userClubs" cascade="save-update"> <key column="user_ID"/> <many-to-many column="activity_ID" class="com.ActivityGB.client.domain.Activity"/> </set> the activity.hbm.xml part <set name="members" inverse="true" table="userClubs" cascade="save-update"> <key column="activity_ID"/> <many-to-many column="user_ID" class="com.ActivityGB.client.domain.User"/> </set> The current userClubs table contains the fields id | user_ID | activity_ID I would like to include in there id | user_ID | activity_ID | role and be able to access the role on both sides...

    Read the article

  • Help with Struts Action mapping

    - by nicotine
    I am having a problem with my struts application it is a class enrollment app and when the user clicks on a "show enrolled courses" button it is supposed to show the courses they are enrolled in but it shows nothing at the moment. Struts/Apache does not return any errors, it Just shows a blank page and I cannot figure out why. My action mapping in my struts-config: <action path="/showEnrolled" type="actions.ShowEnrolledAction" name="UserFormEnrolled" scope="request" validate="true" input="/students/StudentMenu.jsp"> <forward name="success" path="/students/enrolled.jsp"/> </action> My link to the jsp enrolled.jsp page: <li><html:form action="/showEnrolled"> <html:hidden property="id" value= "<%=request.getRemoteUser()%>"/> <html:submit value = "View Enrolled Classes"/> </html:form> </li> When I click the link I get nothing but my menu on the page. The text headings for the page are not even displayed.

    Read the article

  • Which ORM to use?

    - by Paja
    I'm developing an application which will have these classes: class Shortcut { public string Name { get; } public IList<Trigger> Triggers { get; } public IList<Action> Actions { get; } } class Trigger { public string Name { get; } } class Action { public string Name { get; } } And I will have 20+ more classes, which will derive from Trigger or Action, so in the end, I will have one Shortcut class, 15 Action-derived classes and 5 Trigger-derived classes. My question is, which ORM will best suit this application? EF, NH, SubSonic, or maybe something else (Linq2SQL)? I will be periodically releasing new application versions, adding more triggers and actions (or changing current triggers/actions), so I will have to update database schema as well. I don't know if EF or NH provides any good methods to easily update the schema. Or if they do, is there any tutorial how to do that? I've already found this article about NH schema updating, quoting: Fortunately NHibernate provides us the possibility to update an existing schema, that is NHibernate creates an update script which can the be applied to the database. I've never found how to actually generate the update script, so I can't tell NH to update the schema. Maybe I've misread something, I just didn't found it. Last note: If you suggest EF, will be EF 1.0 suitable as well? I would rather use some older .NET than 4.0.

    Read the article

  • Linq to Entities custom ordering via position mapping table

    - by Bigfellahull
    Hi, I have a news table and I would like to implement custom ordering. I have done this before via a positional mapping table which has newsIds and a position. I then LEFT OUTER JOIN the position table ON news.newsId = position.itemId with a select case statement CASE WHEN [position] IS NULL THEN 9999 ELSE [position] END and order by position asc, articleDate desc. Now I am trying to do the same with Linq to Entities. I have set up my tables with a PK, FK relationship so that my News object has an Entity Collection of positions. Now comes the bit I can't work out. How to implement the LEFT OUTER JOIN. I have so far: var query = SelectMany (n => n.Positions, (n, s) => new { n, s }) .OrderBy(x => x.s.position) .ThenByDescending(x => x.n.articleDate) .Select(x => x.n); This kinda works. However this uses a INNER JOIN so not what I am after. I had another idea: ret = ret.OrderBy(n => n.ShufflePositions.Select(s => s.position)); However I get the error DbSortClause expressions must have a type that is order comparable. I also tried ret = ret.GroupJoin(tse.ShufflePositions, n => n.id, s => s.itemId, (n, s) => new { n, s }) .OrderBy(x => x.s.Select(z => z.position)) .ThenByDescending(x => x.n.articleDate) .Select(x => x.n); but I get the same error! If anyone can help me out, it would be much appreciated!

    Read the article

  • sqlalchemy dynamic mapping

    - by adancu
    Hi, I have the following problem: I have the class: class Word(object): def __init__(self): self.id = None self.columns = {} def __str__(self): return "(%s, %s)" % (str(self.id), str(self.columns)) self.columns is a dict which will hold (columnName:columnValue) values. The name of the columns are known at runtime and they are loaded in a wordColumns list, for example wordColumns = ['english', 'korean', 'romanian'] wordTable = Table('word', metadata, Column('id', Integer, primary_key = True) ) for columnName in wordColumns: wordTable.append_column(Column(columnName, String(255), nullable = False)) I even created a explicit mapper properties to "force" the table columns to be mapped on word.columns[columnName], instead of word.columnName, I don't get any error on mapping, but it seems that doesn't work. mapperProperties = {} for column in wordColumns: mapperProperties['columns[\'%']' % column] = wordTable.columns[column] mapper(Word, wordTable, mapperProperties) When I load a word object, SQLAlchemy creates an object which has the word.columns['english'], word.columns['korean'] etc. properties instead of loading them into word.columns dict. So for each column, it creates a new property. Moreover word.columns dictionary doesn't even exists. The same way, when I try to persist a word, SQLAlchemy expects to find the column values in properties named like word.columns['english'] (string type) instead of the dictionary word.columns. I have to say that my experience with Python and SQLAlchemy is quite limited, maybe it isn't possible to do what I'm trying to do. Any help appreciated, Thanks in advance.

    Read the article

  • Problem with 2 levels of inheritance in hibernate mapping

    - by Seth
    Here's my class structure: class A class B extends A class C extends A class D extends C class E extends C And here are my mappings (class bodies omitted for brevity): Class A: @Entity @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @MappedSuperclass @DiscriminatorColumn( name="className", discriminatorType=DiscriminatorType.STRING ) @ForceDiscriminator public abstract class A Class B: @Entity @DiscriminatorValue("B") public class B extends A Class C: @Entity @DiscriminatorValue("C") @MappedSuperclass @DiscriminatorColumn( name="cType", discriminatorType=DiscriminatorType.STRING ) @ForceDiscriminator public abstract class C extends A Class D: @Entity @DiscriminatorValue("D") public class D extends C Class E: @Entity @DiscriminatorValue("E") public class E extends C I've got a class F that contains a set of A: @Entity public class F { ... @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL) @JoinTable( name="F_A", joinColumns = @JoinColumn(name="A_ID"), inverseJoinColumns = @JoinColumn(name="F_ID") ) private Set<A> aSet = new HashSet<A>(); ... The problem is that whenever I add a new E instance to aSet and then call session.saveOrUpdate(fInstance), hibernate saves with "A" as the discrimiator string. When I try to access the aSet in the F instance, I get the following exception (full stacktrace ommitted for brevity): org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: path.to.class.A Am I mapping the classes incorrectly? How am I supposed to map multiple levels of inheritance? Thanks for the help!

    Read the article

  • android opengl es texture mapping into polygons

    - by kamil
    I wrote opengl es code for android to map textures on a square but i want to draw texture on polygons. When user moved the image, texture will be mapped on polygons have more vertexes. I tried the arrays combination below for pentagon but i could not find the correct triangle combination in indices array. public float vertices[] = { // -1.0f, 1.0f, 0.0f, //Top Left // -1.0f, -1.0f, 0.0f, //Bottom Left // 1.0f, -1.0f, 0.0f, //Bottom Right // 1.0f, 1.0f, 0.0f //Top Right -1.0f, 1.0f, 0.0f, //Top Left -1.0f, -1.0f, 0.0f, //Bottom Left 1.0f, -1.0f, 0.0f, //Bottom Right 1.0f, 1.0f, 0.0f, //Top Right 0.4f, 1.4f, 0.0f }; /** Our texture pointer */ private int[] textures = new int[1]; /** The initial texture coordinates (u, v) */ private float texture[] = { //Mapping coordinates for the vertices // 1.0f, 0.0f, // 1.0f, 1.0f, // 0.0f, 1.0f, // 0.0f, 0.0f, // 0.0f, 1.0f, // 0.0f, 0.0f, // 1.0f, 0.0f, // 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.7f, }; /** The initial indices definition */ private byte indices[] = { //2 triangles // 0,1,2, 2,3,0, 0,1,2, 2,3,4, 3,4,0, //triangles for five vertexes }; i draw with the code below gl.glDrawElements(GL10.GL_TRIANGLES, indices.length, GL10.GL_UNSIGNED_BYTE, indexBuffer);

    Read the article

  • EFv1 mapping 1 to many Relationship to POCOs

    - by Scott
    I'm trying to work through a problem where I'm mapping EF Entities to POCO which serve as DTO. I have two tables within my database, say Products and Categories. A Product belongs to one category and one category may contain many Products. My EF entities are named efProduct and efCategory. Within each entity there is the proper Navigation Property between efProduct and efCategory. My Poco objects are simple public class Product { public string Name { get; set; } public int ID { get; set; } public double Price { get; set; } public Category ProductType { get; set; } } public class Category { public int ID { get; set; } public string Name { get; set; } public List<Product> products { get; set; } } To get a list of products I am able to do something like public IQueryable<Product> GetProducts() { return from p in ctx.Products select new Product { ID = p.ID, Name = p.Name, Price = p.Price ProductType = p.Category }; } However there is a type mismatch error because p.Category is of type efCategory. How can I resolve this? That is, how can I convert p.Category to type Category? I know in .NET EF has added support for POCO, but I'm forced to use .NET 3.5 SP1.

    Read the article

  • Mapping one column in a table to multiple tables

    - by user1721814
    I am working on a new product development creating a WMS system. I have done it in past using ASP, VB, and other techniques where we did not hard code the mapping. But now i am working on it using MVC and entity frame work and i am stumped. How can i map one column in transaction table to a column in multiple tables. I have transaction table trans Transid orderref TType productid qty ....(More Columns) now the orderref will hold either Receiptkey, orderkey , movementkey, adjustmentkey and the TType column will tell me which type of transaction i am dealing with and based on that i would know which table to link further. Now how can i achieve this in Entity Frame work. This is the most important step. I have done this many times in my other languages but now using EF i am stuck. Please help. I have checked a lot online but i have not found it. I am new to MVC and entity frame work architecture. Any guidance would be highly appreciated. Ranjit

    Read the article

  • Memory mapping of files and system cache behavior in WinXP

    - by Canopus
    Our application is memory intensive and deals with reading a large number of disk files. The total load can be more than 3 GB. There is a custom memory manager that uses memory mapped files to achieve reading of such a huge data. The files are mapped into the process memory space only when needed and with this the process memory is well under control. But what is observed is, with memory mapping, the system cache keeps on increasing until it occupies the available physical memory. This leads to the slowing down of the entire system. My question is how to prevent system cache from hogging the physical memory? I attempted to remove the file buffering (by using FILE_FLAG_NO_BUFFERING ), but with this, the read operations take considerable amount of time and slows down the application performance. How to achieve the scalability without sacrificing much on performance. What are the common techniques used in such cases? I dont have a good understanding of the WinXP OS caching behavior. Any good links explaining the same would also be helpful.

    Read the article

  • m2e lifecycle-mapping not found

    - by TraderJoeChicago
    I am trying to use the solution described here to solve the annoying "Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.7:add-source (execution: default, phase: generate-sources)" when I place the following plugin on my pom.xml: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <phase>generate-sources</phase> <goals><goal>add-source</goal></goals> <configuration> <sources> <source>src/bootstrap/java</source> </sources> </configuration> </execution> </executions> </plugin> But when I run mvn clean install I get this: Reason: POM 'org.eclipse.m2e:lifecycle-mapping' not found in repository: Unable to download the artifact from any repository Does anyone have a clue on how to make m2e and maven happy?

    Read the article

  • hibernate annotation bi-directional mapping

    - by smithystar
    I'm building a web application using Spring framework and Hibernate with annotation and get stuck with a simple mapping between two entities. I'm trying to create a many-to-many relationship between User and Course. I followed one of the Hibernate tutorials and my implementation is as follows: User class: @Entity @Table(name="USER") public class User { private Long id; private String email; private String password; private Set<Course> courses = new HashSet<Course>(0); @Id @GeneratedValue @Column(name="USER_ID") public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Column(name="USER_EMAIL") public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Column(name="USER_PASSWORD") public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "USER_COURSE", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = { @JoinColumn(name = "COURSE_ID") }) public Set<Course> getCourses() { return courses; } public void setCourses(Set<Course> courses) { this.courses = courses; } } Course class: @Entity @Table(name="COURSE") public class Course { private Long id; private String name; @Id @GeneratedValue @Column(name="COURSE_ID") public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Column(name="NAME") public String getName() { return name; } public void setName(String name) { this.name = name; } } The problem is that this implementation only allows me to go one way user.getCourses() What do I need to change, so I can go in both directions? user.getCourses() course.getUsers() Any help would be appreciated.

    Read the article

  • Domain model for an online WYSYWG webpage generator / runtime

    - by CharlieBrown
    Hi all, I'm using C#, MVC, NHibernate and StructureMap as my IoC container, and need some ideas regarding my domain model. The application I'm working has two parts: an Authoring part and a Runtime part. The idea is to allow the user to create a webpage in Authoring (mostly a form actually) by choosing from a set of predefined controls. That webpage will be later used as a form in a call center environment (Runtime part), or may be used in an intranet portal, etc. Basically something similar to what a CMS would do. The difference is, of course, that the webpage/form the author generates will be used and fulfilled in runtime, and that authros should be able to freely create the webpage they want without limitations. I have a draft working model that allows a RunController to iterate over the ScriptPage (my class for the "generated webpage") Controls collection and uses partial views to render each of them. Works kind of fine. Basically I have a common ScriptControl class, and then I can create for example a TextInputControl or a DropDownControl by inheriting from that base class. I can also figure out the Authoring part of the app, although that will surely be fun in itself for sure. :) The biggest problem I have now is persistance. In order to be flexible, I want to be able to add more controls, and template controls (think of an Address composite control) in sepparate DLLs, so I think having a relational model that handles very possible control is not the way to go. My current thinking is using a kind of ObjectStore: binary-serializing the ScriptPage object that contains the List collection and deserializing at Runtime, but I'm not sure how good will it work with NHibernate and how good the performance will be. Serializing a small "page" with 10 controls results in 7964 bytes, for example. Any ideas out there? Thanks in advance, excuse the length. ;)

    Read the article

  • How do you get the solution directory in C# (VS 2008) in code?

    - by IsaacB
    Hi, Got an annoying problem here. I've got an NHibernate/Forms application I'm working through SVN. I made some of my own controls, but when I drag and drop those (or view some form editors where I have already dragged and dropped) onto some of my other controls, Visual studio decides it needs to execute some of the code I wrote, including the part that looks for hibernate.cfg.xml. I have no idea why this is, but (sometimes!) when it executes the code during my form load or drag and drop it switches the current directory to C:\program files\vs 9.0\common7\ide, and then nhibernate throws an exception that it can't find hibernate.cfg.xml, because I'm searching for that in a relative path. Now, I don't want to hard code the location of hibernate.cfg.xml, or just copy hibernate.cfg.xml to the ide directory (which will work). I want a solution that gets the solutions directory while the current directory is common7\ide. Something that will let someone view my forms in the designer on a fresh checkout to an arbitrary directory on an arbitrary machine. And no, I'm not about to load the controls in code. I have so many controls within controls that it is a nightmare to line everything up without it. I tried a pre build event that made a file that has the solution directory in it, but of course how can I find that from common7\ide? All the projects files need to be in the solution directory because of svn. Thanks for your help guys, I've already spent a few hours fiddling with this in vain.

    Read the article

  • JPA Problems mapping relationships

    - by Rosen Martev
    Hello. I have a problem when I try to persist my model. An exception is thrown when creating the EntityManagerFactory: Blockquote javax.persistence.PersistenceException: [PersistenceUnit: NIF] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34) at project.serealization.util.PersistentManager.createSession(PersistentManager.java:24) at project.serealization.SerializationTest.testProject(SerializationTest.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.hibernate.HibernateException: Wrong column type in nif.action_element for column FLOW_ID. Found: double, expected: bigint at org.hibernate.mapping.Table.validateColumns(Table.java:284) at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1116) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139) at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:349) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) ... 24 more The code for SimpleActionElement and SimpleFlow is as follows: @Entity public class SimpleActionElement { @OneToOne(cascade = CascadeType.ALL, targetEntity = SimpleFlow.class) @JoinColumn(name = "FLOW_ID") private SimpleFlow<T> flow; ... } @Entity public class SimpleFlow<T> { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ELEMENT_ID") private Long element_id; ... }

    Read the article

  • Need to create street maps images with route plotted from address 1 to address 2

    - by daustin777
    I'm looking for software to create street map images that show the route from address 1 to address 2. It needs to be able to create the map images from either a database file that contains the addresses, a delimited text file that lists the addresses to route in each row, or an Excel file. I need to do this to create custom maps in bulk- 500 to 20,000 quantity from the data file. The purpose is to provide a map with a route from a location (address 1) to a retail store (address 2). The maps will be printed on a postcard. I have the data. I just need the mapping software. Is there software available that can do this?

    Read the article

  • How to remove permanent map of a network drive on OS X Lion?

    - by Flijfi
    Some time ago I mapped a network drive on my Snow Leopard Mac, which was upgraded to Lion. The network drive is not active any more and I receive popups all the time with the error: There was a problem connecting to the server XXXX. I have no idea how I configured at the time. I may have included a mount command, in a config file but I don't know any more where I did it. I reviewed the Preferences/Account/Login items and there is no permanent mapping there. OSX is updated as Nov 27,2011 and the issue is not related to the upgrade to Lion itself but to a misconfiguration. Any help will be greatly appreciated. (If you have the opposite problem, here is the link to solve it: Permanently map a network drive on Mac OS X Leopard)

    Read the article

  • [Closed] Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLExce

    - by gauravkarnatak
    Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLException: Closed Connection I am using weblogic 10 JNDI datasource to create JDBC connections, below is my config <?xml version="1.0" encoding="UTF-8"?> <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90" xmlns:sec="http://www.bea.com/ns/weblogic/90/security" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd"> <name>XL-Reference-DS</name> <jdbc-driver-params> <url>jdbc:oracle:oci:@abc.XL.COM</url> <driver-name>oracle.jdbc.driver.OracleDriver</driver-name> <properties> <property> <name>user</name> <value>DEV_260908</value> </property> <property> <name>password</name> <value>password</value> </property> <property> <name>dll</name> <value>ocijdbc10</value> </property> <property> <name>protocol</name> <value>oci</value> </property> <property> <name>oracle.jdbc.V8Compatible</name> <value>true</value> </property> <property> <name>baseDriverClass</name> <value>oracle.jdbc.driver.OracleDriver</value> </property> </properties> </jdbc-driver-params> <jdbc-connection-pool-params> <initial-capacity>1</initial-capacity> <max-capacity>100</max-capacity> <capacity-increment>1</capacity-increment> <test-connections-on-reserve>true</test-connections-on-reserve> <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name> </jdbc-connection-pool-params> <jdbc-data-source-params> <jndi-name>ReferenceData</jndi-name> <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol> </jdbc-data-source-params> </jdbc-data-source> When I run a bulk task where there are lots of connections made and closed, sometimes it gives connection closed exception for any of the task in the bulk task. Below is detailed exception' java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207) at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:3512) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3265) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3367) Any ideas?

    Read the article

  • Many-to-many mapping with LINQ

    - by Alexander
    I would like to perform LINQ to SQL mapping in C#, in a many-to-many relationship, but where data is not mandatory. To be clear: I have a news site/blog, and there's a table called Posts. A blog can relate to many categories at once, so there is a table called CategoriesPosts that links with foreign keys with the Posts table and with Categories table. I've made each table with an identity primary key, an id field in each one, if it matters in this case. In C# I defined a class for each table, defined each field as explicitly as possible. The Post class, as well as Category class, have a EntitySet to link to CategoryPost objects, and CategoryPost class has 2 EntityRef members to link to 2 objects of each other type. The problem is that a Post may relate or not to any category, as well as a category may have posts in it or not. I didn't find a way to make an EntitySet<CategoryPost?> or something like that. So when I added the first post, all went well with not a single SQL statement. Also, this post was present in the output. When I tried to add the second post I got an exception, Object reference not set to an instance of an object, regarding to the CategoryPost member. Post: [Table(Name="tm_posts")] public class Post : IDataErrorInfo { public Post() { //Initialization of NOT NULL fields with their default values } [Column(Name = "id", DbType = "int", CanBeNull = false, IsDbGenerated = true, IsPrimaryKey = true)] public int ID { get; set; } private EntitySet<CategoryPost> _categoryRef = new EntitySet<CategoryPost>(); [Association(Name = "tm_rel_categories_posts_fk2", IsForeignKey = true, Storage = "_categoryRef", ThisKey = "ID", OtherKey = "PostID")] public EntitySet<CategoryPost> CategoryRef { get { return _categoryRef; } set { _categoryRef.Assign(value); } } } CategoryPost [Table(Name = "tm_rel_categories_posts")] public class CategoryPost { [Column(Name = "id", DbType = "int", CanBeNull = false, IsDbGenerated = true, IsPrimaryKey = true)] public int ID { get; set; } [Column(Name = "fk_post", DbType = "int", CanBeNull = false)] public int PostID { get; set; } [Column(Name = "fk_category", DbType = "int", CanBeNull = false)] public int CategoryID { get; set; } private EntityRef<Post> _post = new EntityRef<Post>(); [Association(Name = "tm_rel_categories_posts_fk2", IsForeignKey = true, Storage = "_post", ThisKey = "PostID", OtherKey = "ID")] public Post Post { get { return _post.Entity; } set { _post.Entity = value; } } private EntityRef<Category> _category = new EntityRef<Category>(); [Association(Name = "tm_rel_categories_posts_fk", IsForeignKey = true, Storage = "_category", ThisKey = "CategoryID", OtherKey = "ID")] public Category Category { get { return _category.Entity; } set { _category.Entity = value; } } } Category [Table(Name="tm_categories")] public class Category { [Column(Name = "id", DbType = "int", CanBeNull = false, IsDbGenerated = true, IsPrimaryKey = true)] public int ID { get; set; } [Column(Name = "fk_parent", DbType = "int", CanBeNull = true)] public int ParentID { get; set; } private EntityRef<Category> _parent = new EntityRef<Category>(); [Association(Name = "tm_posts_fk2", IsForeignKey = true, Storage = "_parent", ThisKey = "ParentID", OtherKey = "ID")] public Category Parent { get { return _parent.Entity; } set { _parent.Entity = value; } } [Column(Name = "name", DbType = "varchar(100)", CanBeNull = false)] public string Name { get; set; } } So what am I doing wrong? How to make it possible to insert a post that doesn't belong to any category? How to insert categories with no posts?

    Read the article

  • Mapping integers to types using C++ template fails in a specific case

    - by Shailesh Kumar
    I am attempting to compile the following template based code in VC++ 2005. #include <iostream> using namespace std; /* * T is a template which maps an integer to a specific type. * The mapping happens through partial template specialization. * In the following T<1> is mapped to char, T<2> is mapped to long * and T<3> is mapped to float using partial template specializations */ template <int x> struct T { public: }; template<> struct T<1> { public: typedef char xType; }; template<> struct T<2> { public: typedef long xType; }; template<> struct T<3> { public: typedef float xType; }; // We can easily access the specific xType for a specific T<N> typedef T<3>::xType x3Type; /*! * In the following we are attempting to use T<N> inside another * template class T2<R> */ template<int r> struct T2 { //We can map T<r> to some other type T3 typedef T<r> T3; // The following line fails typedef T3::xType xType; }; int main() { T<1>::xType a1; cout << typeid(a1).name() << endl; T<2>::xType a2; cout << typeid(a2).name() << endl; T<3>::xType a3; cout << typeid(a3).name() << endl; return 0; } There is a particular line in the code which doesn't compile: typedef T3::xType xType; If I remove this line, compilation goes fine and the result is: char long float If I retain this line, compilation errors are observed. main.cpp(53) : warning C4346: 'T<x>::xType' : dependent name is not a type prefix with 'typename' to indicate a type main.cpp(54) : see reference to class template instantiation 'T2<r>' being compiled main.cpp(53) : error C2146: syntax error : missing ';' before identifier 'xType' main.cpp(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int I am not able to figure out how to make sure that T::xType can be treated as a type inside the T2 template. Any help is highly appreciated.

    Read the article

  • mapping rect in small image to larger image (in order to do a copyPixels operation)

    - by skinnyTOD
    Hi all - this is (I think) a relatively simple math question but I've spent a day banging my head against it and have only the dents and no solution... I'm coding in actionscript 3 - the functionality is: large image loaded at runtime. The bitmapData is stored and a smaller version is created to display on the available screen area (I may end up just scaling the large image since it is in memory anyway). The user can create a rectangle hotspot on the smaller image (the functionality will be more complex: multiple rects with transparency: example a donut shape with hole, etc) 3 When the user clicks on the hotspot, the rect of the hotspot is mapped to the larger image and a new bitmap "callout" is created, using the larger bitmap data. The reason for this is so the "callout" will be better quality than just scaling up the area of the hotspot. The image below shows where I am at so far- the blue rect is the clicked hotspot. In the upper left is the "callout" - copied from the larger image. I have the aspect ratio right but I am not mapping to the larger image correctly. Ugly code below... Sorry this post is so long - I just figured I ought to provide as much info as possible. Thanks for any tips! --trace of my data values *source BitmapDada 1152 864 scaled to rect 800 600 scaled BitmapData 800 600 selection BitmapData 58 56 scaled selection 83 80 ratio 1.44 before (x=544, y=237, w=58, h=56) (x=544, y=237, w=225.04, h=217.28) * Image here: http://i795.photobucket.com/albums/yy237/skinnyTOD/exampleST.jpg public function onExpandCallout(event:MouseEvent):void{ if (maskBitmapData.getPixel32(event.localX, event.localY) != 0){ var maskClone:BitmapData = maskBitmapData.clone(); //amount to scale callout - this will vary/can be changed by user var scale:Number =150 //scale percentage var normalizedScale :Number = scale/=100; var w:Number = maskBitmapData.width*normalizedScale; var h:Number = maskBitmapData.height*normalizedScale; var ratio:Number = (sourceBD.width /targetRect.width); //creat bmpd of the scaled size to copy source into var scaledBitmapData:BitmapData = new BitmapData(maskBitmapData.width * ratio, maskBitmapData.height * ratio, true, 0xFFFFFFFF); trace("source BitmapDada " + sourceBD.width, sourceBD.height); trace("scaled to rect " + targetRect.width, targetRect.height); trace("scaled BitmapData", bkgnImageSprite.width, bkgnImageSprite.height); trace("selection BitmapData", maskBitmapData.width, maskBitmapData.height); trace("scaled selection", scaledBitmapData.width, scaledBitmapData.height); trace("ratio", ratio); var scaledBitmap:Bitmap = new Bitmap(scaledBitmapData); var scaleW:Number = sourceBD.width / scaledBitmapData.width; var scaleH:Number = sourceBD.height / scaledBitmapData.height; var scaleMatrix:Matrix = new Matrix(); scaleMatrix.scale(ratio,ratio); var sRect:Rectangle = maskSprite.getBounds(bkgnImageSprite); var sR:Rectangle = sRect.clone(); var ss:Sprite = new Sprite(); ss.graphics.lineStyle(8, 0x0000FF); //ss.graphics.beginFill(0x000000, 1); ss.graphics.drawRect(sRect.x, sRect.y, sRect.width, sRect.height); //ss.graphics.endFill(); this.addChild(ss); trace("before " + sRect); w = uint(sRect.width * scaleW); h = uint(sRect.height * scaleH); sRect.inflate(maskBitmapData.width * ratio, maskBitmapData.height * ratio); sRect.offset(maskBitmapData.width * ratio, maskBitmapData.height * ratio); trace(sRect); scaledBitmapData.copyPixels(sourceBD, sRect, new Point()); addChild(scaledBitmap); scaledBitmap.x = offsetPt.x; scaledBitmap.y = offsetPt.y; } }

    Read the article

  • What is the best .NET web development framework?

    - by tjjjohnson
    I'm looking for a framework to simplify the creation of a website with social networking features and plenty of custom functionality. I'm quite keen to use an ORM like nHibernate or similar for data access. Would DotNetNuke be a good choice? Or are there other options which are better. Added: I'm quite keen not to have to reinvent the wheel for the social network features like secure login, open id, friends etc.

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >