Search Results

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

Page 107/183 | < Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >

  • how do use Ninject with class libraries I am developing?

    - by Greg
    Hi, If I am working on a class library how do I make use of Ninject here? Ie from the internal class library point of view and also from the client code? For example: should the class library have it's own IOC set up, or should it always assume the client code will supply? if no (ie it's upto the client to have the IOC in place) then where is the mapping data stored here'. Is this mapping of the class library's functionality to be places in the client? have a reusable library that is available, that uses interfaces with classes that use the getInstance concept to create concrete classes for you to use, then in this case would that make sense on the client side to use the IOC container to create instances of these classes? Or is that really applying a double layer of abstraction? Q2 Or in the cases where I'm building the reusable library myself and want the client to use an IOC container, then in my reusable library would I then dispense with any overhead of having factories or "getInstance" methods to instantiate the classes in the client? (i.e. as the IOC container would do this no?)

    Read the article

  • How do I create a class repository in Java and do I really need it?

    - by Roman
    I have a large number of objects which are identified by names (strings). So, I would like to have a kind of mapping from object name to the class instances. I was told that in this situation I can use a "repository" class which works like that: Server myServer = ServerRepository.getServer("NameOfServer"); So, if there is already an object (sever) with the "NameOfServer" it will be returned by the "getServer". If such an object does not exist yet, it will be created and returned by the "getServer". So, my question is how to program such a "repository" class? In this class I have to be able to check if there is an instance of a given class such that it has a given value of a given field. How can I do it? I need to have a kind of loop over all existing object of a given class? Another part of my question is why I cannot use associative arrays (associative container, map, mapping, dictionary, finite map)? (I am not sure how do you call it in Java) In more details, I have an "array" which maps names of objects to objects. So, whenever I create a new object, I add a new element to the array: myArray["NameOfServer"] = new Server("NameOfServer").

    Read the article

  • LINQ to SQL: Reusable expression for property?

    - by coenvdwel
    Pardon me for being unable to phrase the title more exact. Basically, I have three LINQ objects linked to tables. One is Product, the other is Company and the last is a mapping table Mapping to store what Company sells which products and by which ID this Company refers to this Product. I am now retrieving a list of products as follows: var options = new DataLoadOptions(); options.LoadWith<Product>(p => p.Mappings); context.LoadOptions = options; var products = ( from p in context.Products select new { ProductID = p.ProductID, //BackendProductID = p.BackendProductID, BackendProductID = (p.Mappings.Count == 0) ? "None" : (p.Mappings.Count > 1) ? "Multiple" : p.Mappings.First().BackendProductID, Description = p.Description } ).ToList(); This does a single query retrieving the information I want. But I want to be able to move the logic behind the BackendProductID into the LINQ object so I can use the commented line instead of the annoyingly nested ternary operator statements for neatness and re-usability. So I added the following property to the Product object: public string BackendProductID { get { if (Mappings.Count == 0) return "None"; if (Mappings.Count > 1) return "Multiple"; return Mappings.First().BackendProductID; } } The list is still the same, but it now does a query for every single Product to get it's BackendProductID. The code is neater and re-usable, but the performance now is terrible. What I need is some kind of Expression or Delegate but I couldn't get my head around writing one. It always ended up querying for every single product, still. Any help would be appreciated!

    Read the article

  • Error in my web.xml

    - by Mercer
    Why i have an error in my web.xml when i want add servlet..? <servlet> <servlet-name>ClientServlet</servlet-name> <servlet-class>org.task.ClientServlet</servlet-class> <servlet-name>FactoryServlet</servlet-name> <servlet-class>org.task.FactoryServlet</servlet-class> <servlet-name>TraderServlet</servlet-name> <servlet-class>org.task.TraderServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ClientServlet</servlet-name> <url-pattern>/ClientServlet</url-pattern> <servlet-name>FactoryServlet</servlet-name> <url-pattern>/FactoryServlet</url-pattern> <servlet-name>TraderServlet</servlet-name> <url-pattern>/TraderServlet</url-pattern> </servlet-mapping>

    Read the article

  • tomcat resource missing, servlet not running

    - by user2837260
    import javax.servlet.*; import java.io.*; public class MyServlet implements Servlet { public void init(ServletConfig con) {} public void service(ServletRequest req, ServletResponse res) throws IOException,ServletException { res.setContentType("text/html"); PrintWriter out=res.getWriter(); String s="blah"; String s1="blah"; out.println("<html><body>"); if((s.equals(req.getParameter("firstname")))&&(s1.equals(req.getParameter("pwd")))) out.println("passwords match"); else out.println("password and name combo does not match"); out.println("</body></html>"); } public void destroy() {} public ServletConfig getServletConfig() { return null;} public String getServletInfo() { return null;} } this is my java file with the servlet class.its saved with the name MyServlet.java and so is the class file. and here is the xml file: <web-app> <servlet> <servlet-name>demoo</servlet-name> <servlet-class>MyServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>demoo</servlet-name> <url-pattern>/demo</url-pattern> </servlet-mapping> </web-app> i have made the folder as WEB-INF and then classes... WEB-INF also contains the .xml file but when i try to run the servlet , it says resource not found ps- i am already looking for the servlet with the name :demo localhost:8081/s1/demo* s1 is the war file * a html file in the war file seems to run fine on the server though. *

    Read the article

  • problem configure JBoss to work with JNDI(2)

    - by Spiderman
    in continuation to the question from last week: http://stackoverflow.com/questions/2828237/problem-configure-jboss-to-work-with-jndi I'm trying to bind datasource in JBoss and use it in my application. In my struggling, I already managed to avoid the javax.naming.NameNotFoundException by: 1. using in java new InitialContext().lookup(connection); instead of new JndiObjectFactoryBean().setJndiName(connection); 2. changing the connection name from: 'jndi-name' to 'java:jndi-name' Now the problem is that the datasouce that I get from the lookup is null. I created the datsource file: <datasources> <local-tx-datasource> <jndi-name>bilby</jndi-name> <connection-url>jdbc:oracle:myURL</connection-url> <driver-class>oracle.jdbc.OracleDriver </driver-class> <user-name>myUsername</user-name> <password>myPassword</password> <exception-sorter-class- name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <metadata> <type-mapping>Oracle9i</type-mapping> </metadata> </local-tx-datasource> </datasources> and put it under \server\default\deploy\oracle-ds.xml I get during runtime the line: 18:37:56,560 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb oss.jca:service=DataSourceBinding,name=bilby' to JNDI name 'java:bilby' So my question is - why do I get null as my datasource???

    Read the article

  • Nullability (Regular Expressions)

    - by danportin
    In Brzozowski's "Derivatives of Regular Expressions" and elsewhere, the function d(R) returning ? if a R is nullable, and Ø otherwise, includes clauses such as the following: d(R1 + R2) = d(R1) + d(R2) d(R1 · R2) = d(R1) ? d(R2) Clearly, if both R1 and R2 are nullable then (R1 · R2) is nullable, and if either R1 or R2 is nullable then (R1 + R2) is nullable. It is unclear to me what the above clauses are supposed to mean, however. My first thought, mapping (+), (·), or the Boolean operations to regular sets is nonsensical, since in the base case, d(a) = Ø (for all a ? S) d(?) = ? d(Ø) = Ø and ? is not a set (nor is the return type of d, which is a regular expression). Furthermore, this mapping isn't indicated, and there is a separate notation for it. I understand nullability, but I'm lost on the definition of the sum, product, and Boolean operations in the definition of d: how are ? or Ø returned from d(R1) ? d(R2), for instance, in the definition off d(R1 · R2)?

    Read the article

  • WCF data services (OData), query with inheritance limitation?

    - by Mathieu Hétu
    Project: WCF Data service using internally EF4 CTP5 Code-First approach. I configured entities with inheritance (TPH). See previous question on this topic: Previous question about multiple entities- same table The mapping works well, and unit test over EF4 confirms that queries runs smoothly. My entities looks like this: ContactBase (abstract) Customer (inherits from ContactBase), this entity has also several Navigation properties toward other entities Resource (inherits from ContactBase) I have configured a discriminator, so both Customer and Resource map to the same table. Again, everythings works fine on the Ef4 point of view (unit tests all greens!) However, when exposing this DBContext over WCF Data services, I get: - CustomerBases sets exposed (Customers and Resources sets seems hidden, is it by design?) - When I query over Odata on Customers, I get this error: Navigation Properties are not supported on derived entity types. Entity Set 'ContactBases' has a instance of type 'CodeFirstNamespace.Customer', which is an derived entity type and has navigation properties. Please remove all the navigation properties from type 'CodeFirstNamespace.Customer'. Stacktrace: at System.Data.Services.Serializers.SyndicationSerializer.WriteObjectProperties(IExpandedResult expanded, Object customObject, ResourceType resourceType, Uri absoluteUri, String relativeUri, SyndicationItem item, DictionaryContent content, EpmSourcePathSegment currentSourceRoot) at System.Data.Services.Serializers.SyndicationSerializer.WriteEntryElement(IExpandedResult expanded, Object element, ResourceType expectedType, Uri absoluteUri, String relativeUri, SyndicationItem target) at System.Data.Services.Serializers.SyndicationSerializer.<DeferredFeedItems>d__b.MoveNext() at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteItems(XmlWriter writer, IEnumerable`1 items, Uri feedBaseUri) at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteFeedTo(XmlWriter writer, SyndicationFeed feed, Boolean isSourceFeed) at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteFeed(XmlWriter writer) at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteTo(XmlWriter writer) at System.Data.Services.Serializers.SyndicationSerializer.WriteTopLevelElements(IExpandedResult expanded, IEnumerator elements, Boolean hasMoved) at System.Data.Services.Serializers.Serializer.WriteRequest(IEnumerator queryResults, Boolean hasMoved) at System.Data.Services.ResponseBodyWriter.Write(Stream stream) Seems like a limitation of WCF Data services... is it? Not much documentation can be found on the web about WCF Data services (OData) and inheritance specifications. How can I overpass this exception? I need these navigation properties on derived entities, and inheritance seems the only way to provide mapping of 2 entites on the same table with Ef4 CTP5... Any thoughts?

    Read the article

  • Worklight console app, update

    - by jarkko
    We're using Worklight 6.1.0.0 / WebSphere 8.0.0.2 (ND/aix). This seemed pretty close to my question too, but for version 6.0. I've successfully done uninstall/install to our worklight console war package. However, there is some extra work on re-deploying adapters and such. I was looking for a way to just update the console. Among the ant tasks there is a target 'minimal-update', which sounds like what I'm looking for (is it?). However when all other pieces fell into place, I have an error for mapping the datasources: ADMA0007E: A validation error occurred in task Mapping resource references to resources. The Java Naming and Directory Interface (JNDI) name is not specified for resource reference jdbc/WorklightDS in module Worklight with EJB name . Contents of the 'minimal-update' task is pretty much the same as for 'install'. I tried that as update from websphere admin console (but i should use the ant task - right?), that gave me a wizard screen to map jdbc/WorklightDS from package to jdbc/WorklightDS on server. This left me wondering how could I tell this using the ant task.

    Read the article

  • Doctrine2 - relationship

    - by Filip Golonka
    I'm developing an application, which is looking for optimal route and timetable in public transport. I have some experience about Doctrine1, but it's my first time with Doctrine2. There is soem new fields to describe relations (mappedBy and inversedBy) and also some new ways of mapping. I have following code: $query = $this->em->createQuery("SELECT partial cls.{stop}, partial t.{arriveTime, departureTime} FROM \Entities\Timetable t JOIN t.ride r JOIN t.carrierLineStop cls WHERE t.departureTime>=:time AND r.idCarrierLine=:carrierLine AND (cls.idStop=:firstStop OR cls.idStop=:lastStop)"); $query->setParameters(array( 'time' => $time, 'carrierLine' => $path->getLine(), 'firstStop' => $path->getFirstStop(), 'lastStop' => $path->getLastStop() )); When I try to execute that script I've got an error: [Semantical Error] line 0, col 24 near '}, partial t.{arriveTime,': Error: There is no mapped field named 'stop' on class Entities\CarrierLineStop. Mapping files: Entities\CarrierLineStop: type: entity table: carrier_line_stop fields: idCarrierLineStop: id: true type: integer unsigned: false nullable: false column: id_carrier_line_stop generator: strategy: IDENTITY nextStop: type: integer unsigned: false nullable: true column: next_stop manyToOne: idCarrierLine: targetEntity: Entities\CarrierLine cascade: { } mappedBy: null inversedBy: null joinColumns: id_carrier_line: referencedColumnName: id_carrier_line orphanRemoval: false stop: column: id_stop targetEntity: Entities\Stop cascade: { } mappedBy: null inversedBy: carrierLineStop joinColumns: id_stop: referencedColumnName: id_stop orphanRemoval: false lifecycleCallbacks: { } - Entities\Stop: type: entity table: stop fields: idStop: id: true type: integer unsigned: false nullable: false column: id_stop generator: strategy: IDENTITY name: type: string length: 45 fixed: false nullable: true miejscowosc: type: string length: 45 fixed: false nullable: true latitude: type: decimal nullable: true longitude: type: decimal nullable: true oneToMany: carrierLineStop: targetEntity: Entities\CarrierLineStop cascade: { } mappedBy: stop inversedBy: null joinColumns: id_stop: referencedColumnName: id_stop orphanRemoval: false lifecycleCallbacks: { } I have no idea about where the problem is...

    Read the article

  • How to use AFIncrementalStore to binding with a NSManagedObject

    - by Matrosov Alexander
    I am searching for more information on how to use AFIncrementalStore. I need to know how to implement it step by step. Please don't down vote it, because of many resources, I really need help with this. If I understood right AFIncrementalStore it is a layer for fetching data from the server and for the mapping data model. Am I right? So I have few URL that I need to mapping into my local model. All of them use GET requests. For example base_url/api/categories I get this string in response: [{"category":{"name":"3d max","id":"1111001","users":[]}}, {"category":{"name":"photoshop","id":"1111002","users":[]}}, {"category":{"name":"auto cad","id":"1111003","users":[]}}] So I have a question how I can binding my local db with this data using AFIncrementalStore. Also if you can see there are relationships in the response string that are connected to uses. The array for users will contain id that is correspond to concert users. So I think second question is how to point that model has to have relationship.

    Read the article

  • DuplicateKeyException in LINQ, but I've set auto increment and auto sync

    - by Fritos
    I'm getting a DuplicateKeyException error in my C# code. I've set Auto Generated = true, and Auto-Sync = OnInsert in my dbml. I'm not even touching the PK field in any manually written code (as seen below [My primary key field is actually called PK]). using (DeviceExerciseDataDataContext context = new DeviceExerciseDataDataContext()) { foreach(Data tgudData in data.Data) { tgd = new tableData(); tgd.FK = key; tgd.Time = tgudData.TimeStamp; tgd.Calories = Convert.ToInt32(tgudData.Calories); tgd.HeartRate = tgudData.AvgHr; tgd.BenchAngle = tgudData.Angle; tgd.WorkoutTarget = 0; tgd.Reps = tgudData.Reps; context.tableDatas.InsertOnSubmit(tgd); } context.SubmitChanges(); } This is the code for the column in the designer (columns are named PK and FK) [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PK", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)] public int PK { get { return this._PK; } set { if ((this._PK != value)) { this.OnPKChanging(value); this.SendPropertyChanging(); this._PK = value; this.SendPropertyChanged("PK"); this.OnPKChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FK", DbType="Int")] public System.Nullable<int> FK { get { return this._FK; } set { if ((this._FK != value)) { this.OnFKChanging(value); this.SendPropertyChanging(); this._FK = value; this.SendPropertyChanged("FK"); this.OnFKChanged(); } } }

    Read the article

  • Spring import runs hibernate persistence twice

    - by Jaanus
    I have 2 spring configurations : spring-servlet.xml spring-security.xml needed to add this line to security: <beans:import resource="spring-servlet.xml"/> Now hibernate is ran twice, this is log screenshot : my web.xml: <servlet> <servlet-name>spring</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/spring-security.xml </param-value> </context-param>

    Read the article

  • How to map combinations of things to a relational database?

    - by Space_C0wb0y
    I have a table whose records represent certain objects. For the sake of simplicity I am going to assume that the table only has one row, and that is the unique ObjectId. Now I need a way to store combinations of objects from that table. The combinations have to be unique, but can be of arbitrary length. For example, if I have the ObjectIds 1,2,3,4 I want to store the following combinations: {1,2}, {1,3,4}, {2,4}, {1,2,3,4} The ordering is not necessary. My current implementation is to have a table Combinations that maps ObjectIds to CombinationIds. So every combination receives a unique Id: ObjectId | CombinationId ------------------------ 1 | 1 2 | 1 1 | 2 3 | 2 4 | 2 This is the mapping for the first two combinations of the example above. The problem is, that the query for finding the CombinationId of a specific Combination seems to be very complex. The two main usage scenarios for this table will be to iterate over all combinations, and the retrieve a specific combination. The table will be created once and never be updated. I am using SQLite through JDBC. Is there any simpler way or a best practice to implement such a mapping?

    Read the article

  • Map Literals to Object Properties/Values

    - by vijay
    For eg, my input XML is look like this. <root> <myelemt> <input type="variable"> <variable>STARTDATE</variable> <variable>CUSTOMERNAME</variable> </input> </myelemt> </root> it is deserialized and loaded into the object MyXmlElemtObj in my code i have written like this, if(MyXmlElemtObj.input.variable.ToUpper() == "STARTDATE") ProcessObjectB(ObjectA.OrderDate); if(MyXmlElemtObj.input.variable.ToUpper() == "CUSTOMERNAME") ProcessObjectB(ObjectC.UserName); Here I am mapping those input literals to some objects value. The one thing that scares me is seeing some ** hard-coded literals** all over my code. Instead i would like to write something like ProcessObjectB(Common.GetMappedvalue(MyXmlElemtObj.input.variable)); Is there a way to isolate this mapping thing to common class, where i will predefine which literal is mapped to which values. The problem is the values are of objects created at the run time. If my question is making sense then So how do i achieve this? I think i have given all the necessary details. if anything is missing please metnion. Thx Much.

    Read the article

  • AutoMapper : Site wide usage of IValueFormatter for given types

    - by CRice
    It is my understanding I can configure AutoMapper in the following way and during mapping it should format all source model dates to the rules defined in the IValueFormatter and set the result to the mapped model. ForSourceType<DateTime>().AddFormatter<StandardDateFormatter>(); ForSourceType<DateTime?>().AddFormatter<StandardDateFormatter>(); I get no effect for my mapped class with this. It only works when I do the following: Mapper.CreateMap<Member, MemberForm>().ForMember(x => x.DateOfBirth, y => y.AddFormatter<StandardDateFormatter>()); I am mapping DateTime? Member.DateOfBirth to string MemberForm.DateOfBirth. The formatter basically creates a short date string from the date. Is there something I am missing when setting the default formatter for a given type? Thanks public class StandardDateFormatter : IValueFormatter { public string FormatValue(ResolutionContext context) { if (context.SourceValue == null) return null; if (!(context.SourceValue is DateTime)) return context.SourceValue.ToNullSafeString(); return ((DateTime)context.SourceValue).ToShortDateString(); } }

    Read the article

  • How to update to jersey 2.X on an app using jersey 1.1X?

    - by Maxrunner
    i recently faced a problem with the handling of exceptions using jersey. In this case it was that the exceptions thrown from Exception mapper are not re thrown to the underlaying container, i searched and found that this has been fixed in the 2.0 version. But i'm using jersey 1.10 and the 2.X dependencies are all different and its also maven based. Since this project is not using maven, how do i use the more recent version?In the 2.X versions there are no jackson json jars for example. So i'm having some doubts in how to upgrade. Here's my web.xml config entry for jerse <servlet> <servlet-name>Jersey REST Service</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.mobile.rest.resources</param-value> </init-param> <init-param> <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name> <param-value>true</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Jersey REST Service</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> regards,

    Read the article

  • Catch hibernate exceptions with errorpage handler?

    - by membersound
    I'm catching all exceptions within: java.lang.Throwable /page.xhtml java.lang.Error /page.xhtml But what If I get eg a hibernate ex: org.hibernate.exception.ConstraintViolationException Do I have to define error-pages for EVERY maybe occuring exception? Can't I just say "catch every exception"? Update Redirect on a 404 works. But on a throwable does not! <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/error.xhtml</location> </error-page> <error-page> <error-code>404</error-code> <location>/error.xhtml</location> </error-page>

    Read the article

  • How to bind a servlet to a context?

    - by simpatico
    I got javax.servlet.ServletException: Error instantiating servlet class servlets.MemoServlet javax.naming.NameNotFoundException: Name servlets.MemoServlet is not bound in this Context when using <form action="MemoServlet"> I know I could use managedbeans, but I've to use servlets. I suspect the problem has to do with JSF. context.xml: <?xml version="1.0" encoding="UTF-8"?> <Context antiJARLocking="true" path="/MemoWeb/faces"/> web.xml: <servlet-mapping> <servlet-name>MemoServlet</servlet-name> <url-pattern>/faces/MemoServlet</url-pattern> </servlet-mapping> <servlet> <servlet-name>MemoServlet</servlet-name> <servlet-class>servlets.MemoServlet</servlet-class> </servlet> I seem to have this problem all over the place: com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection on managed bean userManager .... Caused by: javax.naming.NameNotFoundException: Name user.UserManager is not bound in this Context

    Read the article

  • JSP displaying source code instead of executing

    - by DJStroky
    I'm new to jsp and have ran into some trouble. Initially, the jsp file and associated java classes were built and tested fine on a test Tomcat server. Now, they've been transitioned to another server of what I believe is the same setup (except it's linux now instead of windows). But when the jsp page is accessed the source code is displayed instead of the jsp actually executing. I've googled for a while but received no success. I had thought that this page might solve the problem since there was no reference to the jsp file I was using or even the following snippets in my web.xml file in the WEB-INF folder: <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <init-param> <param-name>logVerbosityLevel</param-name> <param-value>WARNING</param-value> </init-param> <load-on-startup>3</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jsp</servlet-name> <url-pattern>*.jsp</url-pattern> </servlet-mapping> I tried inserting these lines and restarting Tomcat, but no success. Any ideas?

    Read the article

  • Can I add a spring mvc filter using jetty with a jar file?

    - by Juan Manuel
    I have a simple web application disguised as a java application (as in, it's a .jar instead of a .war), and I'd like to use a filter for my requests. If it was a .war, I could initialize it with a WebAppContext and specify a web.xml file where I'd have my filter declaration like this <filter> <filter-name>myFilter</filter-name> <filter-class>MyFilterClass</filter-class> </filter> <filter-mapping> <filter-name>myFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> However, I'm using a simple Context to initialize my application with Spring. Server server = new Server(8082); Context root = new Context(server, "/", Context.SESSIONS); DispatcherServlet dispatcherServlet = new DispatcherServlet(); dispatcherServlet.setContextConfigLocation("classpath:application-context.xml"); root.addServlet(new ServletHolder(dispatcherServlet), "/*"); server.start(); Is there a way to programmatically specify filters for the spring servlet, without using a web.xml file?

    Read the article

  • Entity Framework does not map 2 columns from a SqlQuery calling a stored procedure

    - by user1783530
    I'm using Code First and am trying to call a stored procedure and have it map to one of my classes. I created a stored procedure, BOMComponentChild, that returns details of a Component with information of its hierarchy in PartsPath and MyPath. I have a class for the output of this stored procedure. I'm having an issue where everything except the two columns, PartsPath and MyPath, are being mapped correctly with these two properties ending up as Nothing. I searched around and from my understanding the mapping bypasses any Entity Framework name mapping and uses column name to property name. The names are the same and I'm not sure why it is only these two columns. The last part of the stored procedure is: SELECT t.ParentID ,t.ComponentID ,c.PartNumber ,t.PartsPath ,t.MyPath ,t.Layer ,c.[Description] ,loc.LocationID ,loc.LocationName ,CASE WHEN sup.SupplierID IS NULL THEN 1 ELSE sup.SupplierID END AS SupplierID ,CASE WHEN sup.SupplierName IS NULL THEN 'Scinomix' ELSE sup.SupplierName END AS SupplierName ,c.Active ,c.QA ,c.IsAssembly ,c.IsPurchasable ,c.IsMachined ,t.QtyRequired ,t.TotalQty FROM BuildProducts t INNER JOIN [dbo].[BOMComponent] c ON c.ComponentID = t.ComponentID LEFT JOIN [dbo].[BOMSupplier] bsup ON bsup.ComponentID = t.ComponentID AND bsup.IsDefault = 1 LEFT JOIN [dbo].[LookupSupplier] sup ON sup.SupplierID = bsup.SupplierID LEFT JOIN [dbo].[LookupLocation] loc ON loc.LocationID = c.LocationID WHERE (@IsAssembly IS NULL OR IsAssembly = @IsAssembly) ORDER BY t.MyPath and the class it maps to is: Public Class BOMComponentChild Public Property ParentID As Nullable(Of Integer) Public Property ComponentID As Integer Public Property PartNumber As String Public Property MyPath As String Public Property PartsPath As String Public Property Layer As Integer Public Property Description As String Public Property LocationID As Integer Public Property LocationName As String Public Property SupplierID As Integer Public Property SupplierName As String Public Property Active As Boolean Public Property QA As Boolean Public Property IsAssembly As Boolean Public Property IsPurchasable As Boolean Public Property IsMachined As Boolean Public Property QtyRequired As Integer Public Property TotalQty As Integer Public Property Children As IDictionary(Of String, BOMComponentChild) = New Dictionary(Of String, BOMComponentChild) End Class I am trying to call it like this: Me.Database.SqlQuery(Of BOMComponentChild)("EXEC [BOMComponentChild] @ComponentID, @PathPrefix, @IsAssembly", params).ToList() When I run the stored procedure in management studio, the columns are correct and not null. I just can't figure out why these won't map as they are the important information in the stored procedure. The types for PartsPath and MyPath are varchar(50).

    Read the article

  • plot 4 different plots inside 1 pdf

    - by ifreak
    I have 2 data frames which i want to generate 3 plots from them and place them inside 1 pdf file as a single column. i want all the plots to have the same x-axis limits(basically the same x-axis) even thought they differ in the name and how they were obtained. the dataframes looks something like that: d1 X Y Z 0.04939317 -0.4622222 13651 0.03202451 -0.4261000 13401 0.09950793 -0.3233025 13151 0.11548556 -0.4637981 12486 0.09817597 -0.4751886 12236 0.15770701 -0.5819355 11986 and d2 V0 V1 V2 V3 sign 1 1 0.379 0.612 pos 2 1 0.378 0.620 pos 3 1 0.578 0.571 neg 4 1 0.978 0.561 pos 5 1 0.758 0.261 neg 6 1 0.378 0.126 neg P.S : both data frames are bigger than this, this is only a part of them V0, V1 and Z range from 1 to 20000 the plots that i created are : From d2 d2plot=ggplot(d1, aes(V0,V1, fill=sign)) + geom_tile()+ scale_fill_manual(values = c("neg" = "yellow", "pos"="red")) +geom_vline(xintercept =10000 ) +geom_text(mapping=aes(x=10000,y=0, label="Stop"), size=4, angle=90, vjust=-0.4, hjust=0) From d1 d1plot = ggplot(d2) + geom_errorbarh(aes(x=z,xmin=z-50,xmax=z+50, y=Y, height = 0.02),color="red")+ opts(legend.position = "none") +geom_vline(xintercept = 10000) +geom_text(mapping=aes(x=10000,y=-0.3, label="Stop"), size=4, angle=90, vjust=-0.4, hjust=0) i've tried grid.arrange(d1plot,d2plot,ncol=1) but the x-axis is different for each plot, i tried changing the aspect ratio, but this will change the y-axis ..i've also tried to use facet_wrap but the problem that my x-axis values have different values, i just want the limits and breaks to be the same and the plots all be aligned in 1 column based on 1 x-axis to comapre the value of the statistical methods in an easy way.

    Read the article

  • Setting up App Engine to receive email addresses with ids in the address

    - by Mark M
    I am writing an App Engine app that is supposed to receive emails in this form: [email protected] (someID is an alphanumeric ID that I generate). I have this in my web.xml thinking it would catch emails that start with 'addcontact.': <servlet> <servlet-name>addNewContactServlet</servlet-name> <servlet-class>com.mycompany.server.AddNewContactServlet</servlet- class> </servlet> <servlet-mapping> <servlet-name>addNewContactServlet</servlet-name> <url-pattern>/_ah/mail/addcontact.*</url-pattern> </servlet-mapping> However, both on my dev machine and on google's servers email is not received. On the dev machine I get this message (I get a similar error in the deployed log) Message send failure HTTP ERROR 404 Problem accessing /_ah/mail/ [email protected]. Reason: NOT_FOUND I can receive email at fully specified addresses or when I use /_ah/mail/* The google documentation made me believe it was possible to include partial email addresses in web.xml. Am I not using the wildcard correctly? Does the period have something to do with it? Can this be done somehow?

    Read the article

  • What does "Select Distinct Null As xxxxx" mean?

    - by Soylent Green
    Background: I am mapping Sybase stored procedure return values to java objects using Spring. For example I map a Sybase datatype of varchar as a String type in Java, and a Sybase datatype of int as an int type in Java, etc. I have come across the following code in one of the stored procedures: SELECT DISTINCT A.Col1 AS val1, A.Col2 AS val2, NULL AS someVal, A.col3 AS val3, ... A.col9 AS val9 FROM #SomeTable A ORDER BY Col2, Col3 I have 2 related questions: What does Null mean in this scenario? I am confused as to what is happening here. I am able to determine the data type of Col1, Col2, etc. of course by looking at the table definition of Table A defined earlier in the stored procedure. Thus I know what datatype I can define in my Java object for val1, val2, etc.. But what about "someVal"? What datatype mapping am I supposed to perform for this Null value? I am fairly inexperienced in SQL. Perhaps the answer is much simpler than I realize.

    Read the article

< Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >