datamapper

.NET Native GUID conversion

半世苍凉 提交于 2019-11-28 10:27:48
I have an external database that is feeding information to me. One saves their data as native GUID format and my other data source supplies standard .NET GUID format string. Is there a tidy way to convert from Native GUID to GUID Structure ? Also is there any validation bit to determine if a provided value is a Native GUID or not? I can't seem to find any if there is one. The difference is as follows: typedef struct _GUID { DWORD Data1; WORD Data2; WORD Data3; BYTE Data4[8]; } GUID; Data1, Data2 and Data3 get their byte order reversed but Data4 remains the same, see http://en.wikipedia.org

Jackson: how to serialize only annotated properties

允我心安 提交于 2019-11-28 09:05:50
I would like to define my custom serialization strategy (which fields to include), while using Jackson. I know, that I can do it with views/filters, but it introduces very bad thing - using string-representation of field names, which automatically enables problems with auto-refactoring. How do I force Jackson into serializing only annotated properties and nothing more? If you disable all auto-detection it should only serialize the properties that you have annotated--whether it be the properties themselves or the getters. Here's a simple example: private ObjectMapper om; @Before public void

Repository and Data Mapper pattern

▼魔方 西西 提交于 2019-11-27 16:57:14
After a lots of read about Repository and Data Mapper I decided to implement those patterns in a test project. Since I'm new to these I'd like to get your views about how did I implement those in a simple project. Jeremy Miller says : Do some sort of nontrivial, personal coding project where you can freely experiment with design patterns. But I don't know I did all this things right or not. Here is my project structure : As you can see there are many folders which I'm going to describe them in detail in below. Domain : Project Domain Entities go here I've a simple Personnel class which is

database.yml &references not working

[亡魂溺海] 提交于 2019-11-27 15:12:15
We just upgraded our virtual machines to what I thought was an identical ruby configuration (via RVM... Ruby 1.9.2, Rails 3.0.7, DataMapper 1.1.0). The biggest difference was that we went from MySQL 5.0 to 5.1. For some reason, the exact same code/database.yml that was working on our old VMs now fails on our new ones at the point it tries to connect to the database. The issue is that this YAML: mysql_defaults: &mysql_defaults adapter: mysql encoding: UTF-8 username: user password: pass host: localhost development: <<: *mysql_defaults database: devdb production: <<: *mysql_defaults database:

In Doctrine 2 can the Fetch Mode (Eager/Lazy etc.) be changed at runtime?

醉酒当歌 提交于 2019-11-27 12:29:24
问题 I have entities which I would like to eagerly load , and on other ocassions lazy (or even extra lazy) load. My mappings have no fetch mode declared in my YAML- so they use the default (lazy loading). Currently the only way to eagerly load is to by constructing the DQL manually - and I need to update this every time I add a new entity. Ideally I would just load the root entity and the force eager loading all the associated objects. Is there any way I can do this? If not why (is there a reason

What is the difference between the Data Mapper, Table Data Gateway (Gateway), Data Access Object (DAO) and Repository patterns?

我怕爱的太早我们不能终老 提交于 2019-11-27 05:45:56
I'm trying to brush up on my design pattern skills, and I'm curious what are the differences between these patterns? All of them seem like they are the same thing - encapsulate the database logic for a specific entity so the calling code has no knowledge of the underlying persistence layer. From my brief research all of them typically implement your standard CRUD methods and abstract away the database-specific details. Apart from naming conventions (e.g. CustomerMapper vs. CustomerDAO vs. CustomerGateway vs. CustomerRepository), what is the difference, if any? If there is a difference, when

database.yml &references not working

社会主义新天地 提交于 2019-11-26 18:29:41
问题 We just upgraded our virtual machines to what I thought was an identical ruby configuration (via RVM... Ruby 1.9.2, Rails 3.0.7, DataMapper 1.1.0). The biggest difference was that we went from MySQL 5.0 to 5.1. For some reason, the exact same code/database.yml that was working on our old VMs now fails on our new ones at the point it tries to connect to the database. The issue is that this YAML: mysql_defaults: &mysql_defaults adapter: mysql encoding: UTF-8 username: user password: pass host:

Who should handle the conditions in complex queries, the data mapper or the service layer?

流过昼夜 提交于 2019-11-26 11:19:44
this question did a very good job of clearing my confusion a bit on the matter, but I'm having a hard time finding reliable sources on what the exact limitations of the service layer should be. For this example, assume we're dealing with books, and we want to get books by author. The BookDataMapper could have a generic get() method that accepts condition(s) such as the book's unique identifier, author name, etc. This implementation is fairly trivial (logically), but what if we want to have multiple conditions that require a more complex query? Lets say we want to get all book written by a

Who should handle the conditions in complex queries, the data mapper or the service layer?

南笙酒味 提交于 2019-11-26 02:20:12
问题 this question did a very good job of clearing my confusion a bit on the matter, but I\'m having a hard time finding reliable sources on what the exact limitations of the service layer should be. For this example, assume we\'re dealing with books, and we want to get books by author. The BookDataMapper could have a generic get() method that accepts condition(s) such as the book\'s unique identifier, author name, etc. This implementation is fairly trivial (logically), but what if we want to have