Search Results

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

Page 77/102 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • how to force nhibernate to set the foreign key of the child item?

    - by npeBeg
    i have a collection in the mapping: <bag name="Values" cascade="all-delete-orphan" lazy="false" inverse="true"> <key column="[TemplateId]"/> <one-to-many class="MyNamespace.Value, MyLib"/> </bag> the Value object has a foreign key [TemplateId]. both entities has their generator set to "identity". when i call session.Save() for the parent Template object, the Value objects has their [TemplateId] (the foreign key) set to zero, so an SQL exception appears. how do i forse nhibernate to set the FK value for the child items to the value of the inserted parent object?

    Read the article

  • how to implement inheritance in hibernate ??

    - by user359057
    Hi guys i am working in a web application. I have a entities as BaseEntity --Which contains user login info like createdBy,createdTime,EditedBy,editedTime Employee -- which contains employee information like name,address,etc... RegularEmployee --which contains salary ,bonus tht kind of fields and ContactEmployee -- which contains HourlyRate,contactPeriod etc.... My inheritance structure is BaseEntity <--- Employee <---- RegularEmployee (i.e. Employee extends BaseEntity and RegularEmployee extends Employee ContractEmployee also extend Employee Class ). How to design database structure in this case considering all the tables have id and version fields (all tables should at least have these two fields).

    Read the article

  • How to generate JPA 2.0 metamodel?

    - by yamsha
    In the spirit of type safety associated with the CriteriaQuery JPA 2.0 also has an API to support Metamodel representation of entities. Is anyone aware of a fully functional implementation of this API (to generate the Metamodel... as opposed to creating the metamodel classes manually)? It would be awesome if someone also knows the steps for setting this up in Eclipse (I assume it's as simple as setting up an annotation processor, but you never know). EDIT: Just stumbled across Hibernate JPA 2 Metamodel Generator . But the issue remains since I can't find any download links for the jar

    Read the article

  • Include in enity framework 4

    - by molgan
    Hello I've been using enity framework that came with 3.5sp. And now I've redone things for enityframework 4 and asp.net mvc 2. I've come across something (which worked in my previous version and asp.net mvc 1.0). I have this: public IQueryable<Booking> GetBookings() { return from b in _entities.Bookings.Include("BookingObject") select b; } And in my controller I have: return View("Index", new BookingsViewModel { Bookings = _br.GetBookings().ByDay(DateTime.Today) }); And it doesnt seem to include the "BookingObject"-entity, so I can type like <%= Model.Bookings.BookingObject.BookingObjectName %> in my view. What might be missing here? Do I need to turn something on in the diagram for it to include entities or? /M

    Read the article

  • Why would I want to have a non-standard attribute?

    - by dontWatchMyProfile
    The documentation on Core Data entities says: You might implement a custom class, for example, to provide custom accessor or validation methods, to use non-standard attributes, to specify dependent keys, to calculate derived values, or to implement any other custom logic. I stumbled over the non-standard attributes claim. It's just a guess: If my attribute is anything other than NSString, NSNumber or NSDate I will want to have a non-standard Attribute with special setter and getter methods? So, for example, if I wanted to store an image, this would be a non-standard Attribute with type NSData and a special method, say -(void)setImageWithFileURL:(NSURL*)url which then pulls the image data from the file, puts in in an NSData and assigns it to core data? Or did I get that wrong?

    Read the article

  • Create a graph image (png, jpg ..) from an XML file with Java

    - by alibm
    Hello, I have an XML file and I want to create a graph with some entities, then store this graph in an image, JPG or PNG. So is there a library in Java do like this?? Or is there some tricks by parsing XML files and ... ??? Here an example XML file: <?xml version="1.0"?> <process> <p n=1>Tove</p> <p n=2>Jani</p> <p n=2>Bill</p> <p n=4>John</p> </process> And the output will be like this. http://i.imgur.com [slash] YevGX.png Please change [slash] by / to see the image. Thanks in advance. Best Regards, AliBM

    Read the article

  • What should layers in dotnet application ?

    - by haansi
    I am using layered architecture in dotnet (mostly I work on web projects). I am confuse what layers should I use ? I have small idea that there should be the following layers. user interface customer types (custom entities) business logic layer data access layer My purpose is sure quality of work and maximum re-usability of code. some one suggested to add common types layer in it. Please guide me what should be layers ? and in each layer what part should go ?

    Read the article

  • Call function from object instantiated in one class in another

    - by Dk43
    I have two classes, both of which need to be able to call the same instance of entitymanager class Engine { EntityManager::Entitymanager EManager; } And I need to add an object to a vector contained by this particular instance of Engine. What I want to do is be able to add a bullet spawned by the player to the vector that contains all my entities. class Player : Entity { void SpawnBullet() {Engine::EManager.Add(BULLET);} } The above returns this error: error: object missing in reference to ‘Engine::EManager’ How do I resolve this? Any help or pointers in the right direction would be much appreciated!

    Read the article

  • Doctrine2: Filtering by ManToMany Association

    - by Shroder
    I want to retrieve a collection of objects based on what they are associated to. For example, by a category. This would be a Many to Many relationship. I've been able to achieve that with MEMBER OF, however I need to pass in an array of IDs, opposed to one at a time. I see there is an "IN ()", but it seems to require a subquery, which I would like to avoid. MEMBER OF example: SELECT o FROM Entity\Object1 o WHERE 'CATEGORY_CODE' MEMBER OF o.categories (Edit) This is what I would like to do, but perhaps I'm misunderstanding how entities work in DQL: SELECT o FROM Entity\Object1 o WHERE o.categories.Id IN (id, id, id)

    Read the article

  • JPA Bidirectional OneToMany and ManyToOne?

    - by PhoenixJon
    I'm using Oracle JDeveloper 11g Release 2. I created two tables A and B using SQL developer. Table A has a FK to table B. Using the Entities from Tables function, I created two JPA files from it. A has @ManyToOne annotation on FK. And also B has @OneToMany annotation to A. I don't want this. Can I remove this @OneToMany annotation automatically? public class A implements Serializable { ... @ManyToOne @JoinColumn(name = "FIELD_B") private B b; ... } public class B implements Serializable { ... @OneToMany(mappedBy = "B") private List<A> assetList; ... } I don't need @OneToMany mapping.

    Read the article

  • Can I bypass an intermediate object in hibernate

    - by Jherico
    I have top level entities TRACK, MEDIA_GROUP and MEDIA, each with an integer primary key. I also have a join table from TRACK to MEDIA_GROUP which is 1:1 and MEDIA has a FK column into MEDIA_GROUP. I'm trying to find a way in hibernate to map a collection of Media directly into the Track object, bypassing the creation of a MediaGroup object. Basically I want to turn this: TRACK <-> MEDIA_TRACK_MAP <-> MEDIA_GROUP <-> MEDIA into this: TRACK <-> MEDIA_TRACK_MAP <-> MEDIA But the join column between MEDIA_TRACK_MAP and MEDIA isn't the primary key of MEDIA.

    Read the article

  • AND NSPedicate on Core Data relationships

    - by jesse001
    I'm having trouble compounding NSPredicate with AND, although using OR works fine. Imagine 2 entities, Doctor and Patient. Doctors can have many patients and patients many doctors. I want to find doctors that, say, have both person1 and person2 as patients. I expected this to work but it returns none. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY patients matches 'person1&&person2'"]; If I change && to ||, I get all doctors that have person1 or person2 as I'd expect. Thanks in advance for your help.

    Read the article

  • Using iPhone Core Data to many Relationship

    - by BLeB
    When I define a to many relationship between entities in Xcode and then generate the data class from the entity I get a header with the following methods defined: @interface PriceList (CoreDataGeneratedAccessors) - (void)addItemsObject:(PriceListItem *)value; - (void)removeItemsObject:(PriceListItem *)value; - (void)addItems:(NSSet *)value; - (void)removeItems:(NSSet *)value; @end When I attempt to call addItemsObject with the following code a doesNotRecognizeSelector exception is thrown. PriceListItem *item = [NSEntityDescription insertNewObjectForEntityForName:@"PriceListItem" inManagedObjectContext:managedObjectContext]; item.cat = [attributeDict valueForKey:@"c"]; item.sel = [attributeDict valueForKey:@"s"]; [self addItemsObject:item]; From what I have read I do not have to implement these methods and that they are generated at runtime. Any ideas?

    Read the article

  • How can I double-enhance a class with cglib?

    - by artemb
    Hi there! Here's the code: Patient patient = factory.createPatient(); Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(patient.getClass()); enhancer.setCallback(new DefaultMethodInterceptor(patient)); patient = (Patient) enhancer.create(); assertThat(patient.getFirstName()).isNotNull(); Enhancer enhancer2 = new Enhancer(); enhancer2.setSuperclass(patient.getClass()); enhancer2.setCallback(new DefaultMethodInterceptor(patient)); patient = (Patient) enhancer2.create(); assertThat(patient.getFirstName()).isNotNull(); It fails on the last assert with net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null ... Caused by: java.lang.reflect.InvocationTargetException ... Caused by: java.lang.ClassFormatError: Duplicate method name&signature in class file my/package/entity/Patient$$EnhancerByCGLIB$$ca1e6685$$EnhancerByCGLIB$$f52743be I ask this because I want to enhance Hibernate's entities, but sometimes it returns already enhanced ones by itself and my second enhancement fails. How can I avoid this?

    Read the article

  • JPA Native Query (SQL View)

    - by Uchenna
    I have two Entities Customer and Account. @Entity @Table(name="customer") public class Customer { private Long id; private String name; private String accountType; private String accountName; ... } @Entity @Table(name="account") public class Account { private Long id; private String accountName; private String accountType; ... } i have a an sql query select a.id as account_id, a.account_name, a.account_type, d.id, d.name from account a, customer d Assumption account and customer tables are created during application startup. accountType and accountName fields of Customer entity should not be created. That is, only id and name columns will be created. Question How do i run the above sql query and return a Customer Entity Object with the accountType and accountName properties populated with sql query's account_name and account_type values. Thanks

    Read the article

  • Stop Entity Framework from updating edmx model with a column that isn't needed

    - by TMan
    I have rowguids in all my tables to help with change tracking in all my tables. I don't want/need these tables in my edmx or my entities. However, I do still need to make changes to other things sometimes so everytime i go to update model from database in the edmx it adds all the rowguids in all my tables everytime and i have to manually delete each one. Is there a way to handle this from happening? Is there a way I can maybe edit the T4 to maybe ignore that 'rowguid' column? Database first Entity framework

    Read the article

  • Delete Entity in Many to Many Relation. Don't get error but entity is not deleted

    - by Shapper
    I have, in EF5, two entities: User and Role. Between User and Role there is a many to many relation. I don't have an entity for the UserRoles database which sets the relation. I have a User and I want to delete a role without loading it from the database. Context context = new Context(); User user = context.Users.First(x => x.Id == 4); user.Roles = new List<Role>(); Role role = new Role { Id = 20 }; context.Roles.Attach(role); user.Roles.Remove(role); context.SaveChanges(); I don't get any error but the role is not removed. Any idea why? Thank you, Miguel

    Read the article

  • Core Data: Detecting the type and casting it

    - by Tim Sullivan
    I have set up a Core Data model that includes an entity, Item with a 1-M relationship with the abstract entity Place, so that an item has many places. There are several entities with the parent set to Place. I want to set up several UI elements depending on the descendent place types. I have a loop that looks something like this: for (Place *place in item.places) { } ... but I'm not sure how to detect what type the place is, and how to cast it to the proper type so that I can access its properties. Thanks for any help!

    Read the article

  • How to handle Foreign Keys with Entity Framework

    - by Jack Marchetti
    I have two entities. Groups. Pools. A Group can create many pools. So I setup my Pool table to have a GroupID foreign key. My code: using (entity _db = new entity()) { Pool p = new Pool(); p.Name = "test"; p.Group.ID = "5"; _db.AddToPool(p); } This doesn't work. I get a null reference exception on p.Group. How do I go about creating a new "Pool" and associating a GroupID?

    Read the article

  • Many-to-Many Relationship (with properties) in Google App Engine for Java

    - by rvandervort
    I understand from the official documentation on unowned relationships that the app must use sets of Key objects on either side of the relationship. This makes perfect sense. Coming from many years of RDBM-style programming, though, I'm pretty confused about how I can model properties of that relationship itself. For example, if I have entities Category and Entry in my many-to-many relationship and would like to persist a dateAdded property, or some other data that are only relevant when both sides of the relationship are known. I suppose it would be possible to create a third class : CategoryEntry that links the two, but this seems like a kludge. What is the proposed way to model this kind of situation ?

    Read the article

  • Difference between SRC and HREF

    - by Vijey
    The SRC and HREF attributes are used to include some external entities like an image, a CSS file, a html file, any other web page or a javascript file. Is there a clear differentiation between SRC and HREF? where/when to use SRC or HREF? I think they can't be used interchangeably. I'm giving below few examples where these attributes are used: To refer a CSS file: href="cssfile.css" inside the link tag To refer a js file: src="myscript.js" inside the script tag To refer an image file: src="mypic.jpg" inside an image tag To refer another webpage: href="http://www.webpage.com" inside an anchor tag

    Read the article

  • Hibernate won't autogenerate sequence table

    - by Jason
    I'm trying to use a sequence table to generate keys for my entities. I notice that if I just use the @GeneratedValue(strategy=GenerationType.TABLE) with no explicit generator, Hibernate will automatically create the hibernate_sequences table in my DB if it doesn't exist. This is great. However, I wanted to make some changes to the sequence table, so I created a @TableGenerator like the following: @GeneratedValue(strategy=GenerationType.TABLE, generator="vdat_seq") @TableGenerator(name="vdat_seq", table="VDAT_SEQ", pkColumnName="seq_name", valueColumnName="seq_next_val", allocationSize=1) This works fine if I manually create the VDAT_SEQ table in my schema; Hibernate won't auto-create it anymore. This causes an issue in my unit tests, since I'd rather not have to manually create a table and maintain it on our testing DB. Is there a configuration variable or some other way to get Hibernate to generate the sequence table?

    Read the article

  • Help moving multiple images at once with touches

    - by daveMac
    Here is my problem: I am trying to move a puzzle piece around the screen and then connect to the other piece if they are in close proximity. I have achieved this, though it is perhaps a little odd the way I did. My problem though is that once they have connected, I can't figure out how to move them as one image, instead of two separate entities. I would really appreciate any help or suggestions. Here is a sample of what I have been doing: (void)touchesMovedNSSet *)touches withEventUIEvent *)event{ UITouch *touch = [touches anyObject]; [self dispatchTouchEvent:[touch view] toPosition:[touch locationInView:self.view]]; } -(void)dispatchTouchEventUIView *)theView toPositionCGPoint)position{ if ((CGRectContainsPoint([picture frame], position))) { picture.center = position; } if (CGRectContainsPoint([picture2 frame], position)) { picture2.center = position; } }

    Read the article

  • Why is Hibernate not loading a column?

    - by B.R.
    I've got an entity with a few properties that gets used a lot in my Hibernate/GWT app. For the most part, everything works fine, but Hibernate refuses to load one of the properties. It doesn't appear in the query, despite being annotated correctly in the entity. The relevant portion of the entity: @Column(name="HasSubSlots") @Type(type="yes_no") public boolean hasSubSlotSupport() { return hasSubSlotSupport; } And the generated SQL query: Hibernate: /* load entities.DeviceModel */ select devicemode0_.DevModel as DevModel1_0_, devicemode0_.InvModelName as InvModel2_1_0_ from DeviceModels devicemode0_ where devicemode0_.DevModel=? Despite the fact that I refer to that property, it's never loaded, lazily or not, and the getter always returns false. Any ideas on how I can dig deeper into this, or what might be wrong?

    Read the article

  • Is this data set in third normal form?

    - by user2980802
    UNF: (Customer-name, Customer-id, Customer-address, (Unit-price, Order-id, Quantity, Product-id, Delivery-date) (Supplier-name, Supplier-id, Supplier-Address) 3NF: CUSTOMER (Customer-id, Order-id, Customer-name, Customer-address) ORDER (Order-id, Customer-id) ORDER/PRODUCT (Order-id, Quantity, Product-id) PRODUCT (Order-id, Product-id, Delivery-date, Supplier-id, Unit-price,) SUPPLIER (Supplier-name, Supplier-id, Supplier-Address, Product-id) Basically, the UNF is the un-normalised form. The information should have EXACTLY five tables, it's a hint we were given. The tables listed are the definite table names. We were told to make assumptions based on this information: Customer Invoice is generated from customer orders (Order & Order/Product entities) Supplier Order is generated for products that are low in stock (Product entity) Assumptions A customer can place many orders but an order is placed by only one customer An order can be for many products and a product can be ordered many times A product is supplied by only one supplier, a supplier may supply many products This is one of my modules in university and my lecturer is all but useful, I'm really struggling so any help is really appreciated.

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >