Blog post on JavaFX three-tier application (including database)

Hey guys,
For anyone interested I have just added a post to my series on Building JEE application with JavaFX. The last two posts have covered client-server remoting over HTTP and database access (using JPA/Hibernate and Spring Data). I know there have been questions asked on these two areas in particular in the past, so I though I would post the link here for reference:
http://www.zenjava.com/2012/03/19/javafx-and-persistence-adding-database-support/
If you are looking at building a production grade client-server/database application (the most common type out there these days) you may find this stuff useful.
Enjoy,
zonski

PetShop
I should mention the company VertigoSoftware that made .NET Pet Shop 4.0;
https://www.vertigo.com/Lab.aspx has a whitepaper link on their site back to Microsoft http://msdn.microsoft.com/en-us/library/aa479070.aspx#bdasamppet4_topic4.
I know how to edit web.config and app.config to move the database to another server; Can someone please tell me how to physically separate the "presentation" layer from the "business
logic + data access" layers i.e. onto different servers? I would like to scale out the web.

Similar Messages

  • Problem if three tier application run through WebStart

    I developed a three tier application (Messaging Service (JMS,JNDI))
    When i run this applivation without web start it run without problem
    but when i run this application through web start the middel tier (JBoss) throwing some exception relATED TO CONNECTION
    Can u give me any hint to solve this problem
    regards
    tushar

    I had no problem with my application .i have a swing based client application that connects to JBoss Application Server to connect to Session Beans, JDO,etc. IT works fine. You need to distribute JBoss-all-client.jar.
    Can you describe your error

  • Three tier Application

    Hi EveryBody
    The way I developed the application is
    First I create java project.
    put all the hibernate related code in it and make 1 point interface class to access add update delete.
    Second Create a Stateless Session Bean 3 with all the business logic in it.
    Third I create a web project where I am using JSF. From JSF manage bean I call Session bean and Its is accessable. but the exception throws when EJB 3 code call simple java project that contain hibernate related code.
    If I create a jar file for java code and attach it to EJB its work but its not development friendly.
    I just give the project reference in the Ejb project and it compile fine. and deploy but I think
    When it deploy It leaves the java project and not bundle it with them
    Any suggestion to solve this issue is really appreciated
    Thank you
    best Regard
    Syed Saifuddin

    Hi Vladimir Pavlov
    Now for checking perpose I just add hibernate.jar and other related jar file in YTEJB project library. And its seems that the problem is resolved. But a new problem comes.
    As it nort allow to add jdbc driver.jar file as lib.
    So I deploy jtds driver with name sqlserver2000.
    Now after all this when I deployed the application it ask for net.sourceforge.jtds.jdbc.Driver
    a line of error is
    Caused by: org.hibernate.HibernateException: JDBC Driver class not found: net.sourceforge.jtds.jdbc.Driver
    my Hibernate file that worked on other server if I package driver with it is
    <!-- Database Connection Setting-->
              <!-- <property name="connection.driver_class">com.mysql.jdbc.Driver</property> -->
              <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
              <!-- <property name="connection.url">jdbc:mysql://localhost:3306/yousifitravel</property> -->
              <property name="connection.url">jdbc:jtds:sqlserver://localhost:1433/YousifiTravel</property>
              <!-- <property name="connection.username">root</property> -->
              <property name="connection.username">sa</property>
              <!-- <property name="connection.password">rootpass</property> -->
              <property name="connection.password"></property>
    Please help me in this regard.
    Thank You
    Syed Saifuddin

  • Three tier one-many issue

    I'm having difficulty with a one to many relationship in a three tier model.
    I am reading an object at the service layer and following an indirection to pull back a list of owned objects through a one to many, then passign it back to my web tier.
    To save the object I pass it back to my service layer, instantiate a uow, do uow.readObject(rmiCopy), then uow.deepMerge(rmiCopy), and commit.
    This always works if I insert or delete or even edit the related objects. But if I update a one-to-one relationship within the child object I get the exception below.
    I've left in the SQL because I don't understand why it is generated and think it may be part of the problem. Note that it is selecting crystal_id and is using crystal_id in the where clause as well. I suppose this suggests an error in my mapping but for the life of me I can't find it.
    Thanks,
    Mike
    5492,5,main]--#executeQuery(ReadObjectQuery(com.sgx.domain.cti.CryoContents))
    2004.06.11 09:51:45.441--ServerSession(19512411)--Thread[HttpRequestHandler-2680
    5492,5,main]--Connection(24797434)--SELECT t1.CRYSTAL_ID, t1.AMOUNT, t1.UOM, t1.
    SUBSTANCE_ID, t0.PH, t0.SMILE_STRING, t0.COMMENTS, t0.SOLUBILITY, t0.GRAMS_PER_5
    0ML, t0.SUBSTANCE_ID, t0.LIQUID_CLASS, t0.SUBSTANCE_NAME, t0.CAS, t0.SUBSTANCE_T
    YPE, t0.IS_CRYO, t0.TUBE_NUMBER, t0.CONCENTRATION, t0.UOM, t0.MOLECULAR_WEIGHT,
    t0.VENDOR FROM SGX.SUBSTANCES t0, SGX.CRYO_CONTENTS t1 WHERE (((t1.CRYSTAL_ID =
    ?) AND (t1.SUBSTANCE_ID = ?)) AND (t0.SUBSTANCE_ID = t1.SUBSTANCE_ID))
    bind => [3878, 134]
    2004.06.11 09:51:45.441--ServerSession(19512411)--Thread[HttpRequestHandler-2680
    5492,5,main]--#reconnecting to external connection pool
    2004.06.11 09:51:45.441--UnitOfWork(25134304)--Thread[HttpRequestHandler-2680549
    2,5,main]--#executeQuery(DoesExistQuery())
    2004.06.11 09:51:45.441--ClientSession(15515681)--Thread[HttpRequestHandler-2680
    5492,5,main]--#executeQuery(DoesExistQuery())
    2004.06.11 09:51:45.441--ServerSession(19512411)--Thread[HttpRequestHandler-2680
    5492,5,main]--Connection(25154336)--SELECT CRYSTAL_ID FROM SGX.CRYO_CONTENTS WHE
    RE ((CRYSTAL_ID = ?) AND (SUBSTANCE_ID = ?))
    bind => [3878, 134]
    2004.06.11 09:51:45.441--ServerSession(19512411)--Thread[HttpRequestHandler-2680
    5492,5,main]--#reconnecting to external connection pool
    2004.06.11 09:51:45.504--UnitOfWork(25134304)--Thread[HttpRequestHandler-2680549
    2,5,main]--#register(com.sgx.domain.cti.Substance@5a77b6)
    2004.06.11 09:51:45.519--UnitOfWork(25134304)--Thread[HttpRequestHandler-2680549
    2,5,main]--java.lang.NullPointerExceptionjava.lang.NullPointerException
    at oracle.toplink.internal.indirection.QueryBasedValueHolder.instantiate
    (Unknown Source)
    at oracle.toplink.internal.indirection.DatabaseValueHolder.getValue(Unkn
    own Source)
    at oracle.toplink.internal.indirection.BasicIndirectionPolicy.cloneAttri
    bute(Unknown Source)
    at oracle.toplink.mappings.ForeignReferenceMapping.buildClone(Unknown So
    urce)
    at oracle.toplink.internal.descriptors.ObjectBuilder.populateAttributesF
    orClone(Unknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.cloneAndRegisterNewObject(U
    nknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.internalRegisterObject(Unkn
    own Source)
    at oracle.toplink.internal.sessions.MergeManager.registerObjectForMergeC
    loneIntoWorkingCopy(Unknown Source)
    at oracle.toplink.internal.sessions.MergeManager.mergeChangesOfCloneInto
    WorkingCopy(Unknown Source)
    at oracle.toplink.internal.sessions.MergeManager.mergeChanges(Unknown So
    urce)
    at oracle.toplink.mappings.CollectionMapping.mergeIntoObject(Unknown Sou
    rce)
    at oracle.toplink.internal.descriptors.ObjectBuilder.mergeIntoObject(Unk
    nown Source)
    at oracle.toplink.internal.sessions.MergeManager.mergeChangesOfCloneInto
    WorkingCopy(Unknown Source)
    at oracle.toplink.internal.sessions.MergeManager.mergeChanges(Unknown So
    urce)
    at oracle.toplink.publicinterface.UnitOfWork.mergeClone(Unknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.deepMergeClone(Unknown Sour
    ce)
    at com.sgx.serviceLayer.cti.impl.CrystalsBean.saveCrystal(CrystalsBean.j
    ava:146)

    Okay, I wonder if someone could just explain the limitations of working with objects in a three-tier application.
    How extensively can I safely modify an object in the web tier and still have it merge successfully when I return a copy to the serviceLayer?
    Is it just that I have to be careful not to follow indirections or is there more to watch out for?
    Mike

  • Free access to R12 Vision Demo including database and unix

    DiligentSolutions presents Oracle E-Buisness Suite 12.1.3 for all the ERP enthusiasts with full access to Applications including Database and Unix access for licensed customers/partners and clients.
    Please note that the Oracle CSI Number is required to gain access to Oracle VISION.
    Registrations can be made at their website http://diligentsolutions.net/?q=pages/form/access-diligentsolutions-oracle-vision-registration
    Thanks and Enjoy

    Pay Oracle for the documentation or attend
    the class conducted by Oracle will do.

  • Three tier (mod pl/sql) vs. two tier (PL/SQL Gateway)

    I've been using 10g Database and 10g application server on separate servers for some time now.
    Going the two tier (11g) route has some attractions, but what are the disadvantages?
    The Oracle documentation I've seen says very little on making the decision, giving benefits as:
    Ease of configuration
    Included in the database
    No separate server installation
    - but no negatives.
    Does anyone have any real live experience of comparing the two options?
    I'm inclined to believe that three tier might have more tuning flexibility, better performance if each tier is on a different server. Maybe worse than two tier if on one server, assuming two tier eliminates communication overheads..
    Does pl/sql gateway have the caching ability of Apache/mod pl/sql - I assume not? - that could make a big difference.
    Any thoughts would be welcome...

    There are several key performance advantages of OHS over EPG. I'm working a lot with the EPG right now and pushing the XDB team to add several of these features (maybe in 11.2, possible backport, but don't count on it). I used recommendations from the yslow Firefox add-in to do some performance tuning. Here's there list of Best Practices:
    http://developer.yahoo.com/performance/rules.html
    - EPG does not add an "Expires" header. So, lets say you have 25 images in your page template, and none of them change. Each page view will still request those 25 images. They use etags, so you don't have to download the images, but your browser still makes the requests which is quite slow. From my testing, pages could be up to 4 times slower with the EPG with a pretty standard template. The XDB team is aware of this and working hard to resolve it.
    - EPG does not support gzip. This is another HUGE performance hit.
    Keep in mind you can't test any of those issue with debug mode in APEX, you really need to use a browser plugin such as Firebug + ySlow. The render speed from APEX's point of view will be the same, no matter what HTTP server you use.
    The other big on is mod_rewrite support. There is no way easily create friendly URLs for your apps. Another thing to consider is that a number of Identity Management systems, such as Oracle Access Manager (OAM) work by installing an Apache Module or in the case of IIS, some type of plugin (forget what they call it). There is no concept of this in EPG.
    IMHO, it's convenient for laptops, but I would never use it for production unless you needed some feature that it exposes, such as WebDav or FTP access to the XDB repository...
    Tyler

  • SharePoint 2013 three-tier architecture

    Hi all, I am going to install SharePoint 2013 in a three-tier farm environment.
    I understand that the only difference between web server and app server is whether or not the "Microsoft SharePoint Foundation Web Application" service application is running or not. If yes = web server, if no = app server. App server is also where
    CA is installed. Both web server and app server will have connection to DB. When web server serves web page requests from users, it will go to DB directly to get the page content.
    However, the real three-tier architecture actually means that only app server should have access to DB. Web server will get the information it needs from the app server.
    Is my understanding correct so far? Why is there a difference between three-tier architecture when it is applied in SharePoint context?

    No, all SharePoint servers directly interface with databases for services that they host (with some exceptions). 3 tier just means you have a "WFE" which end users interact with, and it doesn't matter what services are on that "WFE",
    another SharePoint server which may do the same or other things, but users don't directly interact with, and of course the SQL Server.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Sharepoint 2013 Foundation three tier farm with two Webservers in NLB

    Heloo,
    I have been strugling with a problem the last htree days.
    I have instelled and configured a sharepoint 2013 three tier farm with Sharepoint 2013 Foundation and MS SQL 2014 Express. This is a Test Farm and all the servers are Windows 2012 R2.
    I have one SQL Server, one Application Server and two Webservers. The tow web servers are configured with Multicasting NLB. The NLB name is "sharepoint.ws.domain.net". The IP of the NLB is also in our DNS Zone.I have made a Web Application with
    the name "sharepoint.ws.domain.net" on port 80 (NLB name) and a Site collection with the same name.
    Now whene I am working on the Sharepoint Site I get very offen a login Window or I get the message "An error occurred while processing the request on the server. The status code returned from the server was: 0".
    The error "An error occurred while processing the request on the server. The status code returned from the server was: 0" comes when I try to create a sub Site (most with no Permissions inheritance)... but not allways. I also get  sometimes
    the same message when I upload files (MS Office documents and PDF files).
    The login Windows comes whene I am navigating throw the Sites... but also not allways.I go to the Site with an IE11 and the Site is also in the Intranet security sites.
    Can you help me on this one...
    Kind Regards
    Ioannis Kyriakidis

    With no hostname on the Web Application, you have to create Host-named Site Collections. So that complicates things a bit.
    As far as NLB setup, you create Web Applications the same way you would otherwise. NLB is simply installed on both Web Servers and placed into the NLB VIP (virtual IP). The DNS A record points at the VIP.
    Also set up your Windows NLB using Unicast instead of Multicast. If you have certain types of switches that block unicast ARP from multiple clients, e.g. Cisco, you may have to make an exception for them (e.g. http://www.cisco.com/c/en/us/support/docs/switches/catalyst-6500-series-switches/107995-microsoft-nlb.html).
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Question about three-tier architecture for MI

    Hi,
    my question is just for the right understanding. If we speak about three-tier architecture of MI is it right, that the following is meant:
    Client = Presentation Tier
    Middleware = Application Tier/Logic Tier/Business Logic Tier
    Backend = Data Tier
    Thank you and regards,
    Florian

    Hi Florian,
    ICF (Internet Communication Framework) is actually a framework provided by any WebAS. MI makes use of this to receive/send the data from/to the client. It is referred to as ABAP Sync Service in MI terminology. Data comes in the form of HTTP stream. A service is created to provide this functionality. It performs the same job as of the J2EE engine in the earlier versions. The advantage being that an intermediate component between the client & middleware is not necessary anymore, because ICF is part of the WebAS itself.
    You can have a look at this in the sicf transaction, provide the service name as MJC, under this u can see that there are 3 services which MI uses - mi_host, mi_service & mi_mds.
    You can set these parameters in the mobileengine.config file to make the client connect to ABAP Sync Service.
    MobileEngine.Sync.Gateway.Service=/sap/bc/MJC/mi_host
    MI.Sync.ProtocolVersion=251500
    I am in the process of writing a blog, please wait for it.
    Regards,
    Nameeta

  • Blog post Publish vs Update

    This question was asked in February here and answered, but it clearly was never addressed.
    When a blog post is saved as a draft, the PUBLISH button becomes the UPDATE button and there is no longer any clear indication to the client of whether their post is public or not. 
    This includes the post list which does not show the status of a blog post.  Is a fix coming?
    Best,
    Rob

    It's a 2-step process. 'Creating pages' does exactly what it says. It's like publishing to a local folder, but with .Mac functionality included. Actual uploading to .Mac only commences when page creation is complete. That's when the progress indicator(s) appear, and it's only then that you regain control of the application.
    As to your concern that the process takes a long time when you add 'just a new photo page', you go on yourself to explain why doing this necessitates re-creation of every page in the site — it's precisely because of 'the name of the new page being added to the list of available photo pages in the list at the top of each page'. Once you add a page and include this on the navigation bar, every page which displays the navigation bar has to be updated.
    [ Visit here for iWeb Tips, Tricks and Hack ]

  • Reporting services in three tier SharePoint 2013 environment

    Hi,
    I am trying to integrate SQL Server 2012SP1 Reporting Services in a three tier SharePoint 2013 environment, but it seems it is not succesful.
    The setup is as following:
    SRV1: SQL Server with content, config,... and the Reporting Service databases.
    SRV2: SharePoint 2013 Application server & Central Administration
    SRV3: SharePoint Web Front with SharePoint sites
    All application pools are started with domain accounts on SRV2 & 3
    When opening the Central Administration site, the Reporting Services Service Application and its Proxy is created and configured. On SRV2 the Application exists in the application pool in IIS, but it does not appear in the SRV3. Should it be created manualluy?
    In Central Administration, when opening the site settings the Reporting Services section is created, but when opening the Site Settings for the root site the section shows variables:
    $Resources:ReportServerResources,ReportServerSiteSettingsGroupTitle;
    $Resources:ReportServerResources,ScheduleList;
    $Resources:ReportServerResources,SiteLevelSettings;
    $Resources:ReportServerResources,ManageSiteDataAlerts;
    I believe i need some help here.
    Thanks in advance.
    Best regards,
    J

    Hi J-S,
    Generally, the issue occurs if you are in the Windows Powershell instead of the SharePoint Management Shell or the Reporting Services - SharePoint mode feature is not installed. So, please double check you are using the SharePoint Management Shell or install
    the Add-in by installing the rssharepoint.msi instead. Here is the download link:
    http://www.microsoft.com/en-us/download/details.aspx?id=35583
    If it is not the issue, please install the Reporting Services - SharePoint mode from the SQL Server 2012 installation media.
    Reference:
    http://msdn.microsoft.com/en-us/library/ms144289.aspx#bkmk_cmdlets_not_recognized
    Regards,
    Mike Yin
    If you have any feedback on our support, please click
    here
    Mike Yin
    TechNet Community Support

  • How to insert a "Recent Blog Posts" section on your website.

    I constantly see on other websites a section of "Recent Blog Posts". And this is not just limited to blog hosting sites (like wordpress and blogger). Check out this picture:
    http://www.premiumwptools.com/wp-content/uploads/2009/10/BVD-Wordpress-Theme.jpg
    At the bottom of the page there is a section that says: "Latest Blog Entries". How do I get this on my home page? Do I do this in Dreamweaver, or is it something I add later when I actually host the site?

    Check out the URL of the picture you referenced:
    premiumwptools.com/wp-content/uploads/2009/10/BVD-Wordpress -Theme.jpg
    premiumwptools = premium Wordpress tools
    wp-content = Wordpress content
    Wordpress-Theme = Wordpress Theme
    Three hints in the URL suggest that you can achieve the function by using wordpress. To do it outside of wordpress you simply edit latest blogs manually if static or use server side scripting language with database if dynamic.
    best,
    Shocker

  • WPF How can I implement the INotifyPropertyChanged in a Three-tier architecture?

    I am a student and I am confused on using the INotifyPropertyChanged in a three-tier style of coding. Can you guys help me a bit with these?
    I have a solution named MetroAppProject. It is composed of four projects (I omitted the using clauses and references, just imagine they are there and are working fine):
    1. MetroApp.BluePrints - a class library composed of the classes in my sql db
    An example of my class
    namespace MetroApp.BluePrints
        public partial class Patient
            public long Id { get; set; }
            public string PatientNumber { get; set; }
            public string LastName { get; set; }
            public string FirstName { get; set; }
            public string MiddleName { get; set; }        
            public string AddressLine1 { get; set; }
            public Nullable<short> CityId { get; set; }
    public string CityName { get; set; }
            public Nullable<short> ProvinceId { get; set; }
    public string ProvinceName { get; set; }        
    Then the second project:
    2. MetroApp.DataAccess = a class library composed of methods that calls my sql procedures. I used the SqlHelper class which contains the connection strings and other stuffs.
    example class
    namespace MetroApp.DataAccess
        public class PatientDb
    public Patient Retrieve(PatientParams parameters)
                SqlCommand command = new SqlCommand();
                Patient singItem = new Patient();
                command.CommandText = "RetrievePatients";
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@Id", parameters.Id).Direction = ParameterDirection.Input;
                DataTable dt = SqlHelper.GetData(command);
                if (dt.Rows.Count > 0)
                    DataRow row = dt.Rows[0];
                    singItem.Id = TDefaultValue.GetInt(row["Id"].ToString());
                    singItem.PatientNumber = TDefaultValue.GetString(row["PatientNumber"].ToString());
                    singItem.LastName = TDefaultValue.GetString(row["LastName"].ToString());
                    singItem.FirstName = TDefaultValue.GetString(row["FirstName"].ToString());
                    singItem.MiddleName = TDefaultValue.GetString(row["MiddleName"].ToString());
                    singItem.AddressLine1 = TDefaultValue.GetString(row["AddressLine1"].ToString());
                    singItem.CityId = TDefaultValue.GetShort(row["CityId"].ToString());
                    singItem.CityName = TDefaultValue.GetString(row["CityName"].ToString());
                    singItem.ProvinceId = TDefaultValue.GetShort(row["ProvinceId"].ToString());
                    singItem.ProvinceName = TDefaultValue.GetString(row["ProvinceName"].ToString());
                return singItem;
            public List<Patient> RetrieveMany(PatientParams parameters)
                var items = new List<Patient>();
                var command = new SqlCommand();
                command.CommandText = "RetrievePatients";
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@Id", parameters.Id).Direction = ParameterDirection.Input;
                command.Parameters.AddWithValue("@PatientNumber", parameters.PatientNumber).Direction = ParameterDirection.Input;
                command.Parameters.AddWithValue("@LastName", parameters.LastName).Direction = ParameterDirection.Input;
                command.Parameters.AddWithValue("@FirstName", parameters.FirstName).Direction = ParameterDirection.Input;
                command.Parameters.AddWithValue("@MiddleName", parameters.MiddleName).Direction = ParameterDirection.Input;            
                command.Parameters.AddWithValue("@CityId", parameters.CityId).Direction = ParameterDirection.Input;
                command.Parameters.AddWithValue("@ProvinceId", parameters.ProvinceId).Direction = ParameterDirection.Input;
                DataTable dt = SqlHelper.GetData(command);
                foreach (DataRow row in dt.Rows)
                    var item = new Patient();
                    item.Id = TDefaultValue.GetLong(row["Id"].ToString());
                    item.PatientNumber = (row["PatientNumber"].ToString());
                    item.LastName = (row["LastName"].ToString());
                    item.FirstName = (row["FirstName"].ToString());
                    item.MiddleName = (row["MiddleName"].ToString());                
                    item.AddressLine1 = (row["AddressLine1"].ToString());
                    item.CityId = (short)row["CityId"].ToString();
                    item.CityName = (row["CityName"].ToString());
                    item.ProvinceId = (short)row["ProvinceId"].ToString();
                    item.ProvinceName = (row["ProvinceName"].ToString());
                    items.Add(item);
                return items;
            public bool Insert(Patient entity, int userId, ref bool doesExist)
                var command = new SqlCommand();
                try
                    command.CommandText = "AddPatient";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@PatientNumber", entity.PatientNumber).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@LastName", entity.LastName).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@FirstName", entity.FirstName).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@MiddleName", entity.MiddleName).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@AddressLine1", entity.AddressLine1).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@CityId", entity.CityId).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@ProvinceId", entity.ProvinceId).Direction = ParameterDirection.Input;
    command.Parameters.AddWithValue("@Id", entity.Id).Direction = ParameterDirection.Input;
                    command.Parameters.Add("@DoesExist", SqlDbType.Bit).Direction = ParameterDirection.Output;
                    int result = SqlHelper.ExecuteNonQuery(command);
                    doesExist = (bool)(command.Parameters["@DoesExist"].Value);
                    entity.Id = (int)(command.Parameters["@Id"].Value);
                    if (result == 0 || doesExist)
                        return false;
                    return true;
                catch (Exception)
                    return false;
            public bool Update(Patient entity, int userId, ref bool doesExist)
                var command = new SqlCommand();
                try
                    command.CommandText = "EditPatient";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@PatientNumber", entity.PatientNumber).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@LastName", entity.LastName).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@FirstName", entity.FirstName).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@MiddleName", entity.MiddleName).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@AddressLine1", entity.AddressLine1).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@CityId", entity.CityId).Direction = ParameterDirection.Input;
                    command.Parameters.AddWithValue("@ProvinceId", entity.ProvinceId).Direction = ParameterDirection.Input;
    command.Parameters.AddWithValue("@Id", SqlDbType.Int).Direction = ParameterDirection.Output;
                    command.Parameters.Add("@DoesExist", SqlDbType.Bit).Direction = ParameterDirection.Output;
    doesExist = (bool)(command.Parameters["@DoesExist"].Value);
                    int result = SqlHelper.ExecuteNonQuery(command);
                    if (result == 0 || doesExist)
                        return false;
                    return true;
                catch (Exception)
                    return false;
    Then a business logic
    3. MetroApp.BusinessLogic = class libray for calling the methods from DataAccess
    namespace MetroApp.BusinessLogic
        public class PatientMgr
            #region Fields
            private readonly PatientDb _db;
            #endregion
            #region Properties
            public Patient Entity { get; set; }
            public List<Patient> EntityList { get; set; }
            public PatientParams Parameters { get; set; }
            #endregion
            #region Constructors
            public PatientMgr()
                _db = new PatientDb();
                Entity = new Patient();
                EntityList = new List<Patient>();
                Parameters = new PatientParams();
            #endregion
            #region Methods
    public Patient Retrieve(PatientParams parameters)
                return _db.Retrieve(parameters);
            public List<Patient> RetrieveMany(PatientParams parameters)
                return _db.RetrieveMany(parameters);
            public bool Insert(Patient entity, int userId, ref bool doesExist)
                return _db.Insert(entity, userId, ref doesExist);
            public bool Update(Patient entity, int userId, ref bool doesExist)
                return _db.Update(entity, userId, ref doesExist);
            #endregion
    Then the last one, the WPF GUI
    <UserControl x:Class="MetroDentProject.Pages.PatientDetailsPage"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 xmlns:dims="clr-namespace:MetroAppProject.UserCons"
                 mc:Ignorable="d" 
                 d:DesignHeight="720" d:DesignWidth="1280">
        <Grid x:Name="MainGrid" >
            <Grid.RowDefinitions>
                <RowDefinition  Height="40"/>
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <GroupBox Grid.Column="0" Grid.Row="1" Grid.RowSpan="7" x:Name="DetailsGroupBox" Header="Patient Details" >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="Id: " Grid.Column="1" Grid.Row="0" Visibility="Collapsed"/>
                    <TextBox x:Name="IdTextBox" Grid.Column="1" Grid.Row="1" Visibility="Collapsed"/>
                    <TextBlock x:Name="PatientNumberTextBlock" Text="Patient Number: " Grid.Column="0" Grid.Row="0" />
                    <TextBox x:Name="PatientNumberTextBox" Grid.Column="1" Grid.Row="0" IsReadOnly="True" IsReadOnlyCaretVisible="True"/>
                    <TextBlock Text="Last Name: " Grid.Column="0" Grid.Row="1" />
                    <TextBox x:Name="LastNameTextBox" Grid.Column="1" Grid.Row="1" />
                    <TextBlock Text="First Name: " Grid.Column="0" Grid.Row="2" />
                    <TextBox x:Name="FirstNameTextBox" Grid.Column="1" Grid.Row="2" />
                    <TextBlock Text="Middle Name: " Grid.Column="0" Grid.Row="3" />
                    <TextBox x:Name="MiddleNameTextBox" Grid.Column="1" Grid.Row="3" />
                </Grid>
            </GroupBox>
            <GroupBox x:Name="ContactDetailsGroupBox" Header="Contact Details" Grid.Column="1" Grid.Row="1" Grid.RowSpan="7">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="Address: " Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" />
                    <TextBlock Text="City: " Grid.Column="0" Grid.Row="2" />
                    <TextBlock Text="Province: " Grid.Column="0" Grid.Row="3"/>
                    <TextBox x:Name="AddressTextBox" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2"
                             TextWrapping="Wrap"
                             AcceptsReturn="True"
                             VerticalScrollBarVisibility="Auto"
                             />
                    <ComboBox x:Name="CitiesComboBox"  Grid.Column="1" Grid.Row="2"  />
                    <ComboBox x:Name="ProvincesComboBox"  Grid.Column="1" Grid.Row="3" />
                </Grid>
            </GroupBox>
            <dims:FunctionButtonsControl x:Name="FunctionButtonsCon" Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="2"
                                         ExecuteClick="FunctionButtonsCon_OnExecuteClick"
                                         UndoClick="FunctionButtonsCon_OnUndoClick"
                                         BackClick="FunctionButtonsCon_OnBackClick"
                                         DeleteClick="FunctionButtonsCon_OnDeleteClick"
                                         />
        </Grid>
    </UserControl>
    I apologize for the long post. As you can see, I don't use binding. Binding requires me to use INotifyPropertyChanged interface which I am not familiar. Can you at least make my project to implement the INotifypropertyChanged?
    Here is my sample code for the WPF page:
    public partial class PatientDetailsPage 
            readonly PatientMgr itemMgr = new PatientMgr();       
            public PatientParams CurrentPar = new PatientParams(); // for undoActionType _action = ActionType.Insert; // this is an enum from another project, ActionType.Insert, ActionType.Update
            public ActionType Action
                get { return _action; }
                set { _action = value; }
            public PatientDetailsPage()
                InitializeComponent();
                BindComboBoxes();
            #region Methods
            public void OnFragmentNavigation(FragmentNavigationEventArgs e)
            public void OnNavigatedFrom(NavigationEventArgs e)
            public void OnNavigatedTo(NavigationEventArgs e)
            {            Setup();
            public void OnNavigatingFrom(NavigatingCancelEventArgs e)
            public Patient GetPageEntity()
                Patient setEntity = new Patient();
                setEntity.Id = (long)IdTextBox.Text;
                setEntity.PatientNumber = PatientNumberTextBox.Text;
                setEntity.LastName = LastNameTextBox.Text;
                setEntity.FirstName = FirstNameTextBox.Text;
                setEntity.MiddleName = MiddleNameTextBox.Text;
                setEntity.AddressLine1 = AddressTextBox.Text;
                setEntity.CityId = (short)CitiesComboBox.SelectedValue);
                setEntity.ProvinceId = (short)ProvincesComboBox.SelectedValue;
                setEntity.StatusId = true;
                return setEntity;
            public void Setup()
                switch (Action)
                    case ActionType.Insert:
                        Clearer(); //clears all textboxes and set all comboboxes to default
                        this.PatientNumberTextBlock.Visibility = Visibility.Collapsed;
                        this.PatientNumberTextBox.Visibility = Visibility.Collapsed;
                        FunctionButtonsCon.ExecuteButton.Content = "Add";
                        FunctionButtonsCon.DeleteButton.IsEnabled = false;
                        FunctionButtonsCon.DeleteButton.Visibility = Visibility.Hidden;
                        break;
                    //**Setup Update
                    case ActionType.Update:CurrentPar.Id = (long)IdTextBox.Text;
                        LoadSingle(CurrentPar);
                        this.PatientNumberTextBlock.Visibility = Visibility.Visible;
                        this.PatientNumberTextBox.Visibility = Visibility.Visible;
                        FunctionButtonsCon.ExecuteButton.Content = "Save";
                        FunctionButtonsCon.DeleteButton.IsEnabled = true;
                        FunctionButtonsCon.DeleteButton.Visibility = Visibility.Visible;
                        break;                
                LastNameTextBox.CaretIndex = LastNameTextBox.Text.Length;
                IsVisibleChanged += AutoFocus;
            public void LoadSingle(PatientParams parameters)
                var entity = itemMgr.Retrieve(parameters); //calls the BusinessLogic
                IdTextBox.Text = (entity.Id);
                PatientNumberTextBox.Text = (entity.PatientNumber);
                LastNameTextBox.Text = (entity.LastName);
                FirstNameTextBox.Text = (entity.FirstName);
                MiddleNameTextBox.Text = (entity.MiddleName);
                AddressTextBox.Text = (entity.AddressLine1);
                CitiesComboBox.SelectedValue = (short)entity.CityId;
                ProvincesComboBox.SelectedValue = (short)entity.ProvinceId;
            public void Save(ActionType action, int userId)
                itemMgr.Entity = GetPageEntity();
                bool doesExist = false;
                switch (action)
                    case ActionType.Insert:
                        if (itemMgr.Insert((itemMgr.Entity), userId, ref doesExist))
                            System.Windows.Forms.MessageBox.Show("Successfully added a Patient!", "Patient Insertion");                  
                        else if (doesExist)
                            System.Windows.Forms.MessageBox.Show("Item already exists.", "Patient Insertion");
                        else
                            System.Windows.Forms.MessageBox.Show("Not all fields were filled in.", "Patient Insertion");
                        break;
                    case ActionType.Update:
                        if (itemMgr.Update(itemMgr.Entity, userId, ref doesExist))
                            System.Windows.Forms.MessageBox.Show("Successfully updated a Patient!", "Patient Modification");
                            itemMgr.Parameters.Id = itemMgr.Entity.Id;
                            Action = ActionType.Update;
                            Setup();
                        else if (doesExist)
                            System.Windows.Forms.MessageBox.Show("Item already exists.", "Patient Modification");
                        else
                            System.Windows.Forms.MessageBox.Show("Not all fields were filled in.", "Patient Modification");
                        break;                
            public void Clearer()
                IdTextBox.Clear();
                PatientNumberTextBox.Clear();
                LastNameTextBox.Clear();
                FirstNameTextBox.Clear();
                MiddleNameTextBox.Clear();
                CitiesComboBox.SelectedIndex = 0;
                ProvincesComboBox.SelectedIndex = 0;
                AddressTextBox.Clear();            
            public void BindComboBoxes()
                CitiesComboBox.ItemsSource = new BindingSource(CommonMgr.GetCitiesDropDown(), null);// the CommonMgr is a static class from another project. It works just fine
                CitiesComboBox.DisplayMemberPath = "Value";
                CitiesComboBox.SelectedValuePath = "Key";           
                ProvincesComboBox.ItemsSource = new BindingSource(CommonMgr.GetProvincesDropDown(), null);
                ProvincesComboBox.DisplayMemberPath = "Value";
                ProvincesComboBox.SelectedValuePath = "Key";
                CitiesComboBox.SelectedIndex = 0;
                ProvincesComboBox.SelectedIndex = 0;
            #endregion
            #region Events
            private void FunctionButtonsCon_OnExecuteClick(object sender, RoutedEventArgs e)
                Save(Action, SessionHelper.MyUser.Id); //SessionHelper.MyUser.Id
            private void FunctionButtonsCon_OnUndoClick(object sender, RoutedEventArgs e)
                if (Action == ActionType.Insert)
                    Clearer();
                    return;
            private void FunctionButtonsCon_OnBackClick(object sender, RoutedEventArgs e)
                Exiter();
            private void FunctionButtonsCon_OnDeleteClick(object sender, RoutedEventArgs e)
                var ans = System.Windows.Forms.MessageBox.Show("Are you sure you want to delete this entry?", "Patient Deletion", MessageBoxButtons.YesNo);
                if (!Equals(ans, System.Windows.Forms.DialogResult.Yes)) return;
                Action = ActionType.Delete;
                Save(Action, SessionHelper.MyUser.Id);
                Exiter();
            #endregion

    Hello Kokombads,
    I thought you are using MVVM from your title but it seems your project is just a simple WPF project. In that way, please check the following msdn article to know how to Implement Property Change Notification
    https://msdn.microsoft.com/en-us/library/ms743695(v=vs.110).aspx
    using System.ComponentModel;
    namespace SDKSample
    // This class implements INotifyPropertyChanged
    // to support one-way and two-way bindings
    // (such that the UI element updates when the source
    // has been changed dynamically)
    public class Person : INotifyPropertyChanged
    private string name;
    // Declare the event
    public event PropertyChangedEventHandler PropertyChanged;
    public Person()
    public Person(string value)
    this.name = value;
    public string PersonName
    get { return name; }
    set
    name = value;
    // Call OnPropertyChanged whenever the property is updated
    OnPropertyChanged("PersonName");
    // Create the OnPropertyChanged method to raise the event
    protected void OnPropertyChanged(string name)
    PropertyChangedEventHandler handler = PropertyChanged;
    if (handler != null)
    handler(this, new PropertyChangedEventArgs(name));
    It is not so complex, you only need to refer to the interface from here:
    https://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=vs.110).aspx
    And understand that you have to do the following:
    For change notification to occur in a binding between a bound client and a data source, your bound type should either:
    Implement the INotifyPropertyChanged interface (preferred).
    Provide a change event for each property of the bound type
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Bug in BLOG Post.aspx

    This is a spin off from a previous issue I had but now I think this is a bug and it appears to only be in the Post.aspx view. To summarize, when the exact same web part is added to the POST.aspx page as well as the /Forms/AllItems.aspx page, it
    crashes on the first and works on the latter.
    To try and keep this short I'll be simple
    Initial setup.....
    1) Create a Team Site with a contacts app
    2) Create a Blog SUB site with a contacts app and a document app
    3) In the team site, create a new Site Column that is a Lookup to it's Contact app (based on Last Name Linked Field)
    4) In the sub BLOG site, create a new Site Column that is a Lookup to it's Contact app (based on Last Name Linked Field)
    5) In the sub BLOG site, add both the Parent Team Site Lookup and the Blog Site Lookup as an "Existing Column" to both the POST and the Document Apps.
    so at this point, you should have a blog sub site with a Post app and a Document app that have 2 new columns added: One is the Contact lookup column from the Parent site, the other is the Contact Lookup column from the local Blog site.
    Let the fun begin...
    6) On the Blog post details page (the page that comes up when you click on the title of an individual BLOG post), add 2 new web parts.... one is the existing "Post" library, which means you would have the same info just in a different view) and
    the other web part is the existing "Document" library. For each newly added Web part.... edit the current view and make sure to include the newly added Lookup columns.
    7) On the Blog's Document library page (the page that comes up when you view everything in this app), add 2 new web parts.... one is the existing "Post" library, and the other web part is the existing "Document" library (which
    is a duplicate of the already existing web part). For each newly added Web part.... edit the current view and make sure to include the newly added Lookup columns.
    Results....
    What you should see is that the actual "POST" page (/List/Posts/Post.aspx?ID=n) will not even display the original untouched web part. The added Document web part (with the new columns showing) will show and the Contact Linking works. The
    second occurrence of the Post Web part (which includes the new lookup columns) crashes and displays an error on the screen.
    If you open up the Document Library, you will see the original untouched web part working, and BOTH of the newly added web parts which includes the exact same "Post" + new Lookup columns as above.
    ... so long story short... the same web part for the same object library with the same display columns works in the _layouts/15/start.aspx#/myDocs/Forms/AllItems.aspx however does not work in the the /_layouts/15/start.aspx#/Lists/Posts/Post.aspx

    If you really feel it's a bug, you could join the +Apple Developer Connection+ — the +ADC Online+ category is free, here:
    ...then you can use this to create a trackable problem report:
    ...And no, you don't need to be a "developer" to join — just an Apple user who wants to make sure Apple knows there's a bug and have the ability to track its resolution.
    Problems with iWeb's blog are a recurring theme on these forums — so you may soon be back with a different iWeb blog problem: Lost all blog entries or all comments or unable to publish, etc. And whether iWeb's blog works well or not is of little concern to Apple as it's only a tiny part of their software repertoire. If you switch to a dedicated blogging platform you're likely to have a better experience. For a success story using a non-iWeb blog hosted on WordPress, see this old thread:
    _To blog or not to blog_

  • Using eclipselink in a three tier

    Hi, I'm using eclipselink in a three tier architechture. Normally this is set up with just one database user having a connection pool. What I want to set up is that all client users log in and get their own connection, so that they use their own database user account. So I need somehow to create an entitymanager that does not use a connection from the connection pool, but creates a connection using the credentials the user logged in the application with.
    Can someone give me a hint how to achieve that?
    TIA,
    Tom

    Hi,
    You can customize the session to use the username and password for logging to database.Below sample code uses sessioncustomizer to customize the user credentials for database login.
    If you are using the JDeveloper for Toplink development.
    Open the persistence.xml in flat editor and select the Topink customization tab and select the below class for Session customization.Whenever application is run the database login will be customized to the passed in username and password values.
    import org.eclipse.persistence.config.SessionCustomizer;
    import org.eclipse.persistence.sessions.Session;
    public class SampleSessionCustomizer implements SessionCustomizer {
    public SampleSessionCustomizer() {
    super();
    public void customize(Session session) throws Exception {
    session.getLogin().setUserName(userName);
    session.getLogin().setPassword(password);
    Hope this helps.
    Regards,
    P.Vinay Kumar

Maybe you are looking for