Search Results

Search found 2536 results on 102 pages for 'entities'.

Page 12/102 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • SharpArch.Core.PreconditionException: For better clarity and reliability, Entities with an assigned

    - by Quintin Par
    When I do a save of an entity with assigned id I get a SharpArch.Core.PreconditionException: For better clarity and reliability, Entities with an assigned Id must call Save or Update My class is public class CompanyUserRepository : RepositoryWithTypedId<CompanyUser, string>, ICompanyUserRepository { public override CompanyUser SaveOrUpdate(CompanyUser entity) { var user = base.SaveOrUpdate(entity); //Do some stuff return user; } } How do I go about saving this entity? RepositoryWithTypedId does not expose a Save method Related question. This tells you the reason, but I haven't found out the Sharp Architecture way to do a Save.

    Read the article

  • How to escape <, >, and & characters to html entities in Oracle PL/SQL

    - by SWilk
    Hi, I need to send HTML emails directly from oracle PL/SQL package. This works almost fine. I have problem with the fact that some of the data fetched from a table contain things like <S>, <L>, and similar fragments, which sometimes ar treated as HTML tags, and even if not, they are always ignored and never displayed. So, I need to escape this column before inserting into email body. Is there a function to escape html special chars into entities automaticly? Or do I need to replace('<','&lt;',string) manually all the special characters? I found a function to escape URLs but not one for HTML :( Best regards, SWilk

    Read the article

  • Database Modelling - Conceptually different entities with near identical fields

    - by Andrew Shepherd
    Suppose you have two sets of conceptual entities: MarketPriceDataSet which has multiple ForwardPriceEntries PoolPriceForecastDataSet which has multiple PoolPriceForecastEntry Both different child objects have near identical fields: ForwardPriceEntry has StartDate EndDate SimulationItemId ForwardPrice MarketPriceDataSetId (foreign key to parent table) PoolPriceForecastEntry has StartDate EndDate SimulationItemId ForecastPoolPrice PoolPriceForecastDataSetId (foreign key to parent table) If I modelled them as separate tables, the only difference would be the foreign key, and the name of the price field. There has been a debate as to whether the two near identical tables should be merged into one. Options I've thought of to model this is: Just keep them as two independent, separate tables Have both sets in the one table with an additional "type" field, and a parent_id equalling a foreign key to either parent table. This would sacrifice referential integrity checks. Have both sets in the one table with an additional "type" field, and create a complicated sequence of joining tables to maintain referential integrity. What do you think I should do, and why?

    Read the article

  • javax.persistence.NoResultException: getSingleResult() did not retrieve any entities

    - by apple1988
    Hello, i have created a namedquery with ejb to check if the username is used. When the singleResult is null, then i get the following Exception : javax.persistence.NoResultException: getSingleResult() did not retrieve any entities But this exception is the result that i want when the username is free. ^^ Here is the code: public User getUserByUsername(String username) throws DAOException{ try{ Query q = em.createNamedQuery(User.getUserByUsername); q.setParameter("username", username); return (User) q.getSingleResult(); }catch(Exception e){ throwException(username, e); return null; } } Does anybody know what the problem is. :( I will return null andy don`t get an Exception. Thank you very much

    Read the article

  • Should Factories Persist Entities?

    - by mxmissile
    Should factories persist entities they build? Or is that the job of the caller? Pseudo Example Incoming: public class OrderFactory { public Order Build() { var order = new Order(); .... return order; } } public class OrderController : Controller { public OrderController(IRepository repository) { this.repository = repository; } public ActionResult MyAction() { var order = factory.Build(); repository.Insert(order); ... } } or public class OrderFactory { public OrderFactory(IRepository repository) { this.repository = repository; } public Order Build() { var order = new Order(); ... repository.Insert(order); return order; } } public class OrderController : Controller { public ActionResult MyAction() { var order = factory.Build(); ... } } Is there a recommended practice here?

    Read the article

  • PHP: xml_parse replaces entities and "?" character

    - by bhefny
    How can I describe something I can't quite put my finger on? I have a module for RSS reading "magpierss" it uses xml_parse() and after extensive troubleshooting all I can come up with is that it removes certain entities like "?" character. I haven't written this module myself but I have traced the code until the part uses xml_parse() and then the output is just replaced. And to my disappointment this behavior exists on our production server only and not the local server. I have compared both php.ini file to search for any differences but couldn't find anything. Could anyone please direct on where to search exactly, i don't even know which direction to start from. Thanks

    Read the article

  • App Engine: how would you... snapshotting entities

    - by Andrew B.
    Let's say you have two kinds, Message and Contact, related by a db.ListProperty of keys on Message. A user creates a message, adds some contacts as recipients, and emails the message. Later, the user deletes one of the contact entities that was a recipient of the message. Our application should delete the appropriate Contact entity, but we want to preserve the original recipient list for the message that was sent for the user's records. In essence, we want a snapshot of the message entity at the time it was sent. If we naively delete the contact entity, though, we lose snapshot integrity; if not, we are left with an invalid key. How would you handle this situation, either in controller logic or model changes? class User(db.Model): email = db.EmailProperty(required=True) class Contact(db.Model): email = db.EmailProperty(required=True) user = db.ReferenceProperty(User, collection_name='contacts') class Message(db.Model): recipients = db.ListProperty(db.Key) # contacts sender = db.ReferenceProperty(User, collection_name='messages') body = db.TextProperty() is_emailed = db.BooleanProperty(default=False)

    Read the article

  • Exposing entities via a nHibernate implementation RIA Services with querystring queries

    - by illdev
    I once read a blog post and cannot find it anymore. drat! It was about a guy who setup a wcf service (I guess RIA, but could have been something else) exposing the model via IQueryable to the querystring. Sou you could say http://host/articles/123/ratings and you'd get a list (soap or json) of serialized Rating entities (the properties which had some attribute attached) which pertained to an article with id 123. All this with nHibernate / nh linq in the back and in surprisingly few lines of code. Anyone knows what I am talking about? Experiences, suggestions?

    Read the article

  • IPhone CoreData: How should I relate many child entities to thier parents

    - by Robert
    I am trying to import data from a database that uses primary key / forign key relations to a core data database in Xcode. I have code that creates hundreds of child entities in a managed object context: Each child has an ID that corresponds to a parent. child1 parentID = 3 child2 parentID = 17 child3 parentID = 17 ... childn parentID = 5 I now need to relate each child to its parent. The parents are all stored in persistent memory. My first thought was to preform a fetch for each child to get its parent. However, I think this would be slow. Am I correct? How should I do this instead?

    Read the article

  • How to generate entities with Objects?

    - by 01
    I want to generate @Enities with seam-gen from existing database. However its generates very simple version only. For Example @Entity @Table(name = "badges") public class Badges implements java.io.Serializable { private Integer id; private **Integer userId**; private String name; private String date; I want him to generate @Entity @Table(name = "badges") public class Badges implements java.io.Serializable { private Integer id; private **User user**; private String name; private String date; I even have constrain on userId and it points to column User.id P.S. Im using MySQL5 and seam gen is using hbm2java to generate entities.

    Read the article

  • How to use #ifdef entities as part of functions in header files

    - by Crazyjavahacking
    I would like to ask if it is possible to use the entities defined in #ifdef block in header files. To be clear, I have following code: #ifdef #include <winsock2.h> #define SOCKET_HANDLE SOCKET #define CONNECTION_HANDLE SOCKET #endif SOCKET_HANDLE createServerSocket(const char* hostAddress, short port); I am Java developer and this seems completely fine for me. However compiler has a problem with this. Can you explain why is that code a problem? Also how can I force to compile it. (The idea is to have generic interface and conditional compilation to determine real types according to running platform at compile time.) Thanks

    Read the article

  • Linq to Entities (EF): How to get the value of a FK without doing the join

    - by Chu
    I'm using the Linq to Entities. I've got my main table, Employee setup with a field named vendorID. Vendor ID is a foreign key into the Vendors table. As it is right now, the Employee object does not directly expose the vendorID. Instead, I can only access it this way: var employee = (from e in context.Employees.Include("tbl_vendors") where e.employeeID = 1 select e).FirstOrDefault(); //this gets the vendor ID int vendorID = employee.tbl_vendors.vendorID; That is just fine and dandy, but it is extra work on the database because it is forcing a join where none is needed. Is there a way to get that key value without being forced to do a join to the tbl_vendors table?

    Read the article

  • Separating data from the UI code with Linq to SQL entities

    - by Sir Psycho
    If it's important to keep data access 'away' from business and presentation layers, what alternatives or approaches can I take so that my LINQ to SQL entities can stay in the data access layer? So far I seem to be simply duplicating the classes produced by sqlmetal, and passing those object around instead simply to keep the two layers appart. For example, I have a table in my DB called Books. If a user is creating a new book via the UI, the Book class generated by sqlmetal seems like a perfect fit although I'm tightly coupling my design by doing so.

    Read the article

  • Creating new Entities from Stored Procedure

    - by SK
    I have a stored procedure that retrieves existing rows from a table and also creates includes new rows that match the table definition and mapped entity (.net 3.5 entity framework). These new rows are not written to the database in the stored procedure. The stored procedure executes, but the new rows that were created will not load the navigation properties sucessfully i.e. the rows that do not actually exist in the database. e.g. database rows: key, data, FK 1, xxx, a 2, xxx, b returned rows from stored procedure: key, data, FK 1, xxx, a 2, xxx, b 3, yyy, a 4, yyy, b The entity will load FK entities a and b for rows 1 and 2, but for rows 3 and 4 the FK entity is null. Do I somehow need to add the new rows to the data context? or turn off tracking?

    Read the article

  • DocumentBuilder.parse() / Parsing Entities

    - by stormin986
    I'm new to parsing XML and am having an issue with entities. (Am doing this on Android, if it makes a difference). Is there a way to have it turn an entity into the character it represents? I have this in the child of an element: "isn&#39;t" (minus quotes). I would prefer it parse it and the end result be a single text node. However, right now this is turned in to TEXT, ENTITY, TEXT. Is there a way to automatically have it parse the entity into text, or a manual way to do it?

    Read the article

  • Hibernate: deletes not cascading for self-referencing entities

    - by jwaddell
    I have the following (simplified) Hibernate entities: @Entity @Table(name = "package") public abstract class Package { protected Content content; @ManyToOne(cascade = {javax.persistence.CascadeType.ALL}) @JoinColumn(name = "content_id") @Fetch(value = FetchMode.JOIN) public Content getContent() { return content; } public void setContent(Content content) { this.content = content; } } @Entity @Table(name = "content") public class Content { private Set<Content> subContents = new HashSet<Content>(); @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "subcontents", joinColumns = {@JoinColumn(name = "content_id")}, inverseJoinColumns = {@JoinColumn(name = "elt")}) @Cascade(value = {org.hibernate.annotations.CascadeType.DELETE, org.hibernate.annotations.CascadeType.REPLICATE}) @Fetch(value = FetchMode.SUBSELECT) public Set<Content> getSubContents() { return subContents; } public void setSubContents(Set<Content> subContents) { this.subContents = subContents; } } So a Package has a Content, and a Content is self-referencing in that it has many sub-Contents (which may contain sub-Contents of their own etc). The relationships are required to be ManyToOne (Package to Content) and ManyToMany (Content to sub-Contents) but for the case I am currently testing each sub-Content only relates to one Package or Content. The problem is that when I delete a Package and flush the session, I get a Hibernate error stating that I'm violating a foreign key constraint on table subcontents, with a particular content_id still referenced from table subcontents. I've tried specifically (recursively) deleting the Contents before deleting the Package but I get the same error. Is there a reason why this entity tree is not being deleted properly?

    Read the article

  • How to load entities into readonly collections using the entity framework

    - by Anton P
    I have a POCO domain model which is wired up to the entity framework using the new ObjectContext class. public class Product { private ICollection<Photo> _photos; public Product() { _photos = new Collection<Photo>(); } public int Id { get; set; } public string Name { get; set; } public virtual IEnumerable<Photo> Photos { get { return _photos; } } public void AddPhoto(Photo photo) { //Some biz logic //... _photos.Add(photo); } } In the above example i have set the Photos collection type to IEnumerable as this will make it read only. The only way to add/remove photos is through the public methods. The problem with this is that the Entity Framework cannot load the Photo entities into the IEnumerable collection as it's not of type ICollection. By changing the type to ICollection will allow callers to call the Add mentod on the collection itself which is not good. What are my options?

    Read the article

  • Two entities with @ManyToOne should join the same table

    - by Ivan Yatskevich
    I have the following entities Student @Entity public class Student implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; //getter and setter for id } Teacher @Entity public class Teacher implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; //getter and setter for id } Task @Entity public class Task implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @ManyToOne(optional = false) @JoinTable(name = "student_task", inverseJoinColumns = { @JoinColumn(name = "student_id") }) private Student author; @ManyToOne(optional = false) @JoinTable(name = "student_task", inverseJoinColumns = { @JoinColumn(name = "teacher_id") }) private Teacher curator; //getters and setters } Consider that author and curator are already stored in DB and both are in the attached state. I'm trying to persist my Task: Task task = new Task(); task.setAuthor(author); task.setCurator(curator); entityManager.persist(task); Hibernate executes the following SQL: insert into student_task (teacher_id, id) values (?, ?) which, of course, leads to null value in column "student_id" violates not-null constraint Can anyone explain this issue and possible ways to resolve it?

    Read the article

  • Two entities with @ManyToOne joins the same table

    - by Ivan Yatskevich
    I have the following entities Student @Entity public class Student implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; //getter and setter for id } Teacher @Entity public class Teacher implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; //getter and setter for id } Task @Entity public class Task implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @ManyToOne(optional = false) @JoinTable(name = "student_task", inverseJoinColumns = { @JoinColumn(name = "student_id") }) private Student author; @ManyToOne(optional = false) @JoinTable(name = "student_task", inverseJoinColumns = { @JoinColumn(name = "teacher_id") }) private Teacher curator; //getters and setters } Consider that author and curator are already stored in DB and both are in the attached state. I'm trying to persist my Task: Task task = new Task(); task.setAuthor(author); task.setCurator(curator); entityManager.persist(task); Hibernate executes the following SQL: insert into student_task (teacher_id, id) values (?, ?) which, of course, leads to null value in column "student_id" violates not-null constraint Can anyone explain this issue and possible ways to resolve it?

    Read the article

  • Java/Hibernate using interfaces over the entities.

    - by Dennetik
    I am using annoted Hibernate, and I'm wondering whether the following is possible. I have to set up a series of interfaces representing the objects that can be persisted, and an interface for the main database class containing several operations for persisting these objects (... an API for the database). Below that, I have to implement these interfaces, and persist them with Hibernate. So I'll have, for example: public interface Data { public String getSomeString(); public void setSomeString(String someString); } @Entity public class HbnData implements Data, Serializable { @Column(name = "some_string") private String someString; public String getSomeString() { return this.someString; } public void setSomeString(String someString) { this.someString = someString; } } Now, this works fine, sort of. The trouble comes when I want nested entities. The interface of what I'd want is easy enough: public interface HasData { public Data getSomeData(); public void setSomeData(Data someData); } But when I implement the class, I can follow the interface, as below, and get an error from Hibernate saying it doesn't know the class "Data". @Entity public class HbnHasData implements HasData, Serializable { @OneToOne(cascade = CascadeType.ALL) private Data someData; public Data getSomeData() { return this.someData; } public void setSomeData(Data someData) { this.someData = someData; } } The simple change would be to change the type from "Data" to "HbnData", but that would obviously break the interface implementation, and thus make the abstraction impossible. Can anyone explain to me how to implement this in a way that it will work with Hibernate?

    Read the article

  • Using SimpleDB (with SimpleSavant) with POCO / existing entities, not attributes on my classes

    - by alex
    I'm trying to use Simple Savant within my application, to use SimpleDB I currently have (for example) public class Person { public Guid Id { get; set; } public string Name { get; set; } public string Description { get; set; } public DateTime DateOfBirth { get; set; } } To use this with Simple Savant, i'd have to put attributes above the class declaration, and property - [DomainName("Person")] above the class, and [ItemName] above the Id property. I have all my entities in a seperate assembly. I also have my Data access classes an a seperate assembly, and a class factory selects, based on config, the IRepository (in this case, IRepository I want to be able to use my existing simple class - without having attributes on the properties etc.. In case I switch out of simple db, to something else - then I only need to create a different implementation of IRepository. Should I create a "DTO" type class to map the two together? Is there a better way?

    Read the article

  • FullCalendar/JSON event feed problem

    - by n4rc1ssus
    I am using a php/MySQL driven event feed to JSON. I am also trying to use greek html entities (i.e. &Gamma-with the semicolon) in the title for the event. Because FullCalendar will not let me see all the processies in firebug I can't see exactly what is going on but it will not render the Γ, etc. I have tried all the combinations I can think of in the php json_encode, the actual MySQL db field result. QTip which fullCalendar recommended on their site actually renders it correctly in the tip rendering. I am at a loss because this is something I really wish to use in the app if at all possible. Any help would be greatly appreciated. Slight Update I finally found that the JSON is being manipulated to make the & itself into &amp';' no matter what I do; so any relevant info on this could come in handy also. Thx

    Read the article

  • Entity Frameworks 4 - Changing the model does not update the T4 self tracking template files

    - by Darren
    I am using self tracking entities and have moved the entity classes to another assembly by using 'Add as link' to point to the TT file as mentioned here. Now though, when I update the model (for instance change a property name) the template is not automatically run and so the entity class does not get updated. I can of course manually run the template to get the updates, but it would be easier if it ran automatically in the way it did before I moved the classes. Is there any way to achieve this? Darren.

    Read the article

  • L2E many to many query

    - by 5YrsLaterDBA
    I have four tables: Users PrivilegeGroups rdPrivileges LinkPrivilege ----------- ---------------- --------------- --------------- userId(pk) privilegeGroupId(pk) privilegeId(pk) privilegeId(pk, fk) privilegeGroupId(fk) name code privilegeGroupId(pk, fk) L2E will not create LinkPrivilege entity for me. So we only have Users, PrivilegeGroups and rdPrivileges entities. PrivilegeGroups and rdPrivileges are many to many relationship. What I need to do is retrieve all code from rdPrivileges table based on a passed in userId. How can I do it? EDIT working code: var acc = from u in db.Users from pg in db.PrivilegeGroups from p in pg.rdPrivileges where u.UserId == userId && u.PrivilegeGroups.PrivilegeGroupId == pg.PrivilegeGroupId select p.Code;

    Read the article

  • Simple way to return anonymous types (to make MVC using LINQ possible)

    - by BlueRaja The Green Unicorn
    I'd like to implement MVC while using LINQ (specifically, LINQ-to-entities). The way I would do this is have the Controller generate (or call something which generates) the result-set using LINQ, then return that to the View to display the data. The problem is, if I do: return (from o in myTable select o); All the columns are read from the database, even the ones (potentially dozens) I don't want. And - more importantly - I can't do something like this: return (from o in myTable select new { o.column }); because there is no way to make anonymous types type-safe! I know for sure there is no nice, clean way of doing this in 3.5 (this is not clean...), but what about 4.0? Is there anything planned, or even proposed? Without something like duck-typing-for-LINQ, or type-safe anonymous return values (it seems to me the compiler should certainly be capable of that), it appears to be nearly impossible to cleanly separate the Controller from the View.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >